New component: LightSwitch

Community Driven Extensions Project
Post Reply
jepsar
Posts: 166
Joined: 03 Sep 2014, 11:41
Location: NL / BE
Contact:

03 Mar 2021, 20:00

https://www.primefaces.org/showcase-ext ... Switch.jsf

Automatically sets a light or dark theme based on the OS settings. Put it in your template like:

Code: Select all

<pe:lightSwitch selected="#{userBean.theme}"/>
userBean should be a session scoped bean with a String type theme property (with both getter and setter). Then set the theme in your web.xml like:

Code: Select all

<context-param>
    <param-name>primefaces.THEME</param-name>
    <param-value>#{userBean.theme}</param-value>
</context-param>
PrimeFaces Developer | PrimeFaces Extensions Developer
GitHub: https://github.com/jepsar
Spotify: 90s Rave, Acid, Trance, House

Post Reply

Return to “Extensions”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 7 guests