Command Palette
Search for a command to run...
Loading...
Loading...
Build intuitive on/off interactions with a customizable Toggle button built on Tailwind CSS and Base UI, ensuring smooth state switching and easy implementation.
The UIAble Toggle is an element for working with binary states like enabling or disabling formatting options (bold/italic) or setting bookmarks. You do not have to include bulky dependencies like npm packages because code itself resides directly into the project.
That means that the DOM, state, and interaction flow are all under your control from day one.
Tailwind CSS is fully utilized for styling to make it effortless to style hover effects, background colors, changing text color for the active state, and even creating focus rings without using any hacks or battling inflexible third-party styles.
On the internal level, it makes accessibility easier by handling pressing states and focus states automatically. Because you have full access to the source code, adding custom features, such as micro-interactions or adding analytics on clicks, becomes just a few minutes work.
UIAble Toggle abstracts away the accessibility complexities of binary, two-state buttons. Built on Base UI principles, it ensures screen readers correctly interpret the aria-pressed attribute, announcing whether the option is 'pressed' or 'unpressed' without you having to manually wire up ARIA logic or manage focus states from scratch.
Because the component file lives completely inside your project, there is zero dependency lock-in. You have total control over the architecture, making it trivial to introduce custom active-state animations, swap out icon sets, or wire the click handler directly into complex local or global state management tools.
It integrates seamlessly with Tailwind CSS and CVA (Class Variance Authority). This guarantees that whether the toggle is active, inactive, hovered, or disabled, its visual styles remain highly predictable, type-safe, and perfectly aligned with your design system's existing utility tokens.
UIAble Toggle is designed for highly composable interactive architectures. It acts as the perfect foundational block for user-driven settings.
You can effortlessly integrate it into advanced layouts such as:
It also fully respects your global design system. If you update your primary accent colors or border radii in your Tailwind configuration, the Toggle will automatically inherit and reflect those changes instantly.