Selectable Button
A button component that can be toggled between selected and unselected states with visual feedback.
With icon
Without icon
Different sizes
Installation
1. Follow the links to install required rlx packages
2. Install the following dependencies
Loading...
API Reference
Props list
| Prop | Type | Default | Example | Description |
|---|---|---|---|---|
selected | boolean | - | true | Whether the button is in the selected state. When selected, the button uses the primary variant with enhanced styling. |
icon | ReactNode | - | <CheckIcon className="size-4" /> | Optional icon element to display before the button content. |
size | "sm" | "default" | "lg" | "icon" | "sm" | default | The size of the button. Accepts the same size values as the underlying Button component. |
className | string | - | custom-class | Additional CSS classes to apply to the button element. |
children | ReactNode | - | Button Text | The content to display inside the button. |
Behavior
The component provides visual feedback based on the selected state:
- When
selectedisfalse, the button uses theoutlinevariant with card background and muted hover effects. - When
selectedistrue, the button uses thedefaultvariant with primary colors and shadow for emphasis. - The component includes smooth transitions between states with a 200ms duration.
- All standard button props are supported through spread props, allowing full customization of button behavior (onClick, disabled, etc.).