States
Pretty Checkbox offers various states including disabled
, something called "locked" state, and much more ๐
Disabled
Nothing fancy here, just add disabled
to the input
and pretty checkbox will take care of the rest ๐
Locked
"Locked" state is a unique. Adding p-locked
on the root div will style the control as though it's not disabled, but will block user interaction.
caution
Using p-locked
might seem exciting, but there are accessibility concerns with using this. Seeing as this is a maintained fork of pretty checkbox it might be removed in the future.
Focus
Among the many states, we can add a bit of class when our control has focus. We can enable a pleasant box-shadow
around the control by adding p-has-focus
to the root div:
Hover
Upon hover we can swap content using p-has-hover
on the root div. Using this requires an extra div
below state
. The awesome part here is we can mix and match different styles between hovered and regular states ๐
Toggle
Pretty Checkbox allows you to show/hide different labels using nothing but CSS using p-on
and p-off
on the state div. By default p-off
will be visible and upon checking p-on
will become visible.
Without Border
Using p-plain
to skip the border:
Mo' Toggle
Mix n' match icons with toggle, just be sure you review the icons guide before proceeding! Make it extra fancy by adding colors, too!