• Settings
    • Locale
    • Change the locale of the datepicker, schedule and client side validation messages.

      Language
      English
      English
      English
      French
      German
      German
      German
      Italian
      Korean
      Spanish
      Catalan
      Dutch
      Portuguese
      Portuguese
      Arabic
      Arabic
      Bulgarian
      Bangla
      Bosnian
      Czech
      Greek
      Estonian
      Persian
      Finnish
      Danish
      Hindi
      Indonesian
      Icelandic
      Croatian
      Japanese
      Hungarian
      Hebrew
      Georgian
      Central Kurdish
      Khmer
      Kyrgyz
      Kazakh
      Lithuanian
      Latvian
      Malay
      Norwegian
      Polish
      Romanian
      Russian
      Slovak
      Slovenian
      Serbian
      Serbian
      Swedish
      Thai
      Turkish
      Ukrainian
      Uzbek
      Vietnamese
      Chinese
      Chinese
  • Resources

ToggleSwitch

ToggleSwitch is used to select a boolean value.

ToggleSwitch Tag Documentation

ToggleSwitch is used to select a boolean value.

NameTypeRequiredDefaultDescription
id String false generated Unique identifier of the component in a namingContainer.
rendered boolean false true Boolean value to specify the rendering of the component, when set to false component will not be rendered.
binding UIComponent false generated An EL expression referring to a server side UIComponent instance in a backing bean.
widgetVar String false generated ('widget_' + componentClientId) Name of the client side widget.
ariaDescribedBy String false The aria-describedby attribute is used to define a component id that describes the current element for accessibility.
ariaLabel String false The aria-label attribute is used to define a string that labels the current element for accessibility.
ariaLabelledBy String false
converter Converter false EL expression resolves to a converter instance or literal converter ID defining a component converter.
converterMessage String false
disabled boolean false false Disables or enables the switch.
immediate boolean false false When set true, process validations logic is executed at apply request values phase for this component.
label String false User presentable name.
offIcon String false The icon representing the "Off" position.
onIcon String false The icon representing the "On" position.
onblur String false Client side callback to execute when component loses focus.
onchange String false Client side callback to execute on value change event.
onfocus String false Client side callback to execute when component receives focus.
readonly boolean false false Flag indicating that this component will prevent changes by the user.
required boolean false false Marks component as required.
requiredMessage String false
style String false Inline style of the component.
styleClass String false Style class of the component.
submittedValue Object false
tabindex String false The tabindex attribute specifies the tab order of an element when the "tab" button is used for navigating.
validator Validator false A method expression referring to a method validating the input.
validatorMessage String false
value Object false Value of the component.
valueChangeListener ValueChangeListener false A method binding expression referring to a method for handling a valuchangeevent.
Loading...
Tag DocumentationNew DocumentationNew Documentation JSDoc
Basic
Icon
Remote

Usage


<div class="card">
    <h:form>
        <p:growl id="msg"/>

        <h5 class="mt-0">Basic</h5>
        <p:toggleSwitch value="#{selectBooleanView.value1}"/>
        
        <h5>Icon</h5>
        <p:toggleSwitch value="#{selectBooleanView.value2}" onIcon="pi pi-check" offIcon="pi pi-times" />

        <h5>Remote</h5>
        <p:toggleSwitch value="#{selectBooleanView.value3}">
            <p:ajax listener="#{selectBooleanView.addMessage}" update="msg"/>
        </p:toggleSwitch>
    </h:form>
</div>