checked- Type
boolean- Default
- -
- Description
- Controlled checked state.
Search for a command to run...
Components / Inputs
மாற்றி
Use a switch for settings that take effect immediately. The label should describe the setting, not the action.
உடனடியாக அமலாகும் அமைப்புகளுக்கு மாற்றியைப் பயன்படுத்தவும். லேபிள் செயலை அல்ல, அமைப்பை விளக்க வேண்டும்.
4 parts documented for implementation and review.
<button>Pill-shaped toggle with role=switch. 44x24px rounded-full. Off state: bg-input (gray). On state: bg-primary (brand). Smooth color transition. Keyboard: Space to toggle. Focus ring on :focus-visible.
<span>Circular thumb (20x20px) sliding between left (off) and right (on) via translate-x. White fill with subtle shadow. CSS transition-transform for smooth animation.
<label>Descriptive label paired via htmlFor. Should name what the switch controls — not just Enable but Enable Tamil notifications. Click toggles the switch.
Muted subtext at text-xs providing context about the switch effect. Connected via aria-describedby. States what happens when toggled.
checkedbooleandefaultCheckedbooleanfalseonCheckedChange(checked: boolean) => voiddisabledbooleanfalse| Prop | Type | Default | Description |
|---|---|---|---|
checked | boolean | - | Controlled checked state. |
defaultChecked | boolean | false | Initial checked state. |
onCheckedChange | (checked: boolean) => void | - | Runs when the value changes. |
disabled | boolean | false | Prevents interaction. |
Switches are ideal for on/off preferences like notifications or dark mode that activate without a Save button.
அறிவிப்புகள் அல்லது இருண்ட நிலை போன்ற உடனடி அமைப்புகளுக்கு Switch மிகவும் பொருத்தமானது.
If users must click Save for changes to apply, use Checkbox instead — Switch implies immediate effect.
மாற்றங்கள் சேமிக்கப்பட வேண்டுமென்றால் Checkbox பயன்படுத்தவும் — Switch உடனடி அமலை குறிக்கிறது.
Show 'இயக்கு / முடக்கு' or 'On / Off' beside the switch so the current state is unambiguous.
'இயக்கு' அல்லது 'முடக்கு' என்று தெளிவான நிலை லேபிள் காட்டி மாற்றியின் தற்போதைய நிலையை தெளிவாக்கவும்.
When users need to select multiple independent options, use Checkboxes — not a set of switches.
பல தனிமையான விருப்பங்கள் தேர்வு செய்ய Checkbox பயன்படுத்தவும் — Switch அல்ல.