Switch

Ripple UI comes with a Switch component that can be used to toggle between two states.

Default

Simple example of switch.

HTML
JSX
<input type="checkbox" class="switch" />

Colors

Switch colors.

HTML
JSX
<input type="checkbox" class="switch switch-primary" checked />
<input type="checkbox" class="switch switch-secondary" checked />
<input type="checkbox" class="switch switch-success" checked />
<input type="checkbox" class="switch switch-error" checked />
<input type="checkbox" class="switch switch-warning" checked />

Bordered

Switch bordered.

HTML
JSX
<input type="checkbox" class="switch switch-bordered-primary" />
<input type="checkbox" class="switch switch-bordered-secondary" />
<input type="checkbox" class="switch switch-bordered-success" />
<input type="checkbox" class="switch switch-bordered-error" />
<input type="checkbox" class="switch switch-bordered-warning" />

Ghost

Switch ghost.

HTML
JSX
<input type="checkbox" class="switch switch-ghost-primary" />
<input type="checkbox" class="switch switch-ghost-secondary" />
<input type="checkbox" class="switch switch-ghost-success" />
<input type="checkbox" class="switch switch-ghost-error" />
<input type="checkbox" class="switch switch-ghost-warning" />

Sizes

Switch sizes.

HTML
JSX
<input type="checkbox" class="switch switch-xs" />
<input type="checkbox" class="switch switch-sm" />
<input type="checkbox" class="switch switch-md" />
<input type="checkbox" class="switch switch-lg" />
<input type="checkbox" class="switch switch-xl" />

Disabled

Switch disabled.

HTML
JSX
<input type="checkbox" class="switch" disabled checked />

Switch Props

API

classDescription
switchSwitch base class
switch-primarySet primary color
switch-secondarySet secondary color
switch-successSet success color
switch-errorSet error color
switch-warningSet warning color
switch-bordered-primaryWith primary border by default
switch-bordered-secondaryWith secondary border by default
switch-bordered-successWith success border by default
switch-bordered-errorWith error border by default
switch-bordered-warningWith warning border by default
switch-ghost-primaryWith border hover effect primary
switch-ghost-secondaryWith border hover effect secondary
switch-ghost-successWith border hover effect success
switch-ghost-errorWith border hover effect error
switch-ghost-warningWith border hover effect warning
switch-xsSet extra small size
switch-smSet small size
switch-mdSet medium size
switch-lgSet large size
switch-xlSet extra large size