SelectionControl
Base selection-control primitive used by Checkbox, Radio, Switch and similar inputs. Renders a ripple zone, a native input and a label with full ARIA support.
Aperçu
Rendu de l’aperçu en cours…
uncheckedRendu de l’aperçu en cours…
checkedRendu de l’aperçu en cours…
radioRendu de l’aperçu en cours…
errorRendu de l’aperçu en cours…
disabledStructure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<origam-selection-control> — 5 parts: root ①, wrapper ②, input zone ③ (with ripple), icon/native input ④, and label ⑤.- 1.origam-selection-control
- Root element. Flex-row, aligns wrapper and label. Carries state modifiers (dirty, disabled, error, focused, inline).
- 2.origam-selection-control__wrapper
- Square wrapper (40px + density). Hosts the ripple zone and the background color layer.
- 3.origam-selection-control__input
- Circular ripple zone (v-ripple). Contains the OrigamIcon (true/falseIcon) and the native input.
- 4input[type="checkbox|radio"] (native)
- Visually hidden native input. Manages browser check state, form submission, and screen-reader focus.
- 5.origam-selection-control__label
- Label container. Renders OrigamLabel with for/id wiring.
API
Props
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.
- labelstring
- Label text displayed next to the control via OrigamLabel.
- trueValueany
- Value emitted when the control is checked.
- falseValueany
- Value emitted when the control is unchecked.
- valueany
- Value for group context. Used by SelectionControlGroup to determine membership.
- requiredbooleanfalse
- Marks the control as required.
- disabledbooleanfalse
- Disables the control.
- errorstring | booleanfalse
- Puts the control in error state. Changes label and icon color.
- namestring
- Name attribute for the native input. Groups radio buttons for browser behaviour.
- readonlybooleanfalse
- Makes the control read-only (no interaction).
- typestring'checkbox'
- Native input type. Usually checkbox or radio. Determines ARIA semantics.
- modelValueany
- Current value. Bound with v-model. Compared against trueValue/falseValue (single) or array membership (group).
- valueComparator(a: any, b: any) => boolean
- Custom equality function for comparing modelValue against trueValue.
- falseIcon
- MDI icon shown when the control is unchecked/false.
- trueIcon
- MDI icon shown when the control is checked/true.
- multipleboolean
- inlinebooleanfalse
- Renders inline instead of block, useful for side-by-side controls.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- color
- Intent or custom color applied to the control icon and label.
- bgColor
- Background color applied to the ripple/wrapper area.
- hoverboolean | IStateEffectConfig
- hoverClassstring
- Controls the wrapper dimensions via density offset.
- borderboolean | number | string | TDirectionBoth | Array<TDirectionBoth>
- borderTopboolean | number | string
- borderLeftboolean | number | string
- borderBottomboolean | number | string
- borderRightboolean | number | string
- borderBlockboolean | number | string
- borderInlineboolean | number | string
- borderInlineStartboolean | number | string
- borderInlineEndboolean | number | string
- borderBlockStartboolean | number | string
- borderBlockEndboolean | number | string
- borderColorstring
- borderStylestring
- borderTopColorTColor
- borderRightColorTColor
- borderBottomColorTColor
- borderLeftColorTColor
- borderInlineStartColorTColor
- borderInlineEndColorTColor
- borderBlockStartColorTColor
- borderBlockEndColorTColor
- roundedboolean | number | string | TRounded | null | undefined
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
- elevationTElevation
- rippleboolean | { class: string }true
- Enables Material ripple effect on the control input zone.
API
Slots
Emplacements de contenu exposés par ce composant.
- #default
- Replaces the wrapper content. Receives the full control state (model, colors, icon, event handlers).
- #label
- Custom label content replacing the default OrigamLabel.
- #input
- Replaces the native input element. Receives all input attributes and handlers. Falls back to icon + native input when not provided.
API
Emits
Événements émis par ce composant.
- @click:labelMouseEvent
- Fired when the user clicks the label area.
- @update:modelValueany
- Emitted when the user toggles the control. Carries the new value.
API
Membres exposés
Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.
- <T extends object>(props: T, exclude?: string[]) => Partial<T>
- Utility to forward a filtered subset of props to sub-components.
- Ref<string>
- Reactive CSS string generated by useStyle.
- string
- Unique style-sheet ID for this instance.
- () => void
- Injects the computed style sheet. Called automatically on mount.
- () => void
- Removes the injected style sheet. Called automatically on unmount.
- Ref<boolean>
- True once the style sheet has been injected.
Personnalisation
Variables CSS
Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.
- Default text/icon color.
- Color when the control is disabled.
- Color when the control is in error state.
- Opacity of the entire control when disabled.
- Density modifier. compact → -8px, comfortable → +8px.
- Transition duration for icon and color animations.
Inclusion
Accessibilité
Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.
Rôles ARIA
Interactions clavier
| Touche | Action |
|---|---|
| Space | Toggles the checkbox or selects the radio option. |
| Tab | Moves focus to the next interactive element. |
Notes
- A native <input type="checkbox|radio"> is always rendered (even when the input slot is customised). This ensures browser-native focus, keyboard handling and form participation.
- aria-checked is set automatically by the native input. For type="checkbox", aria-checked is forwarded explicitly via the :aria-checked binding.
- The label is wired to the input via for/id. Clicking the label toggles the control and fires click:label.
- When error=true, the label and icon adopt --origam-selection-control---color-error for visual feedback. No aria-invalid is set at this layer — use OrigamInput / form-level components for validation semantics.
Fondation
Design tokens
Extrait des tokens de ce composant — les variables --origam-<composant>---<propriété>, déclarées dans sa feuille de tokens tenue à la main, sans étape de build.
- colorvar(--origam-color__text---primary)
- Default control color.
- colorvar(--origam-color__text---disabled)
- Color when disabled.
- numbervar(--origam-opacity---50)
- Opacity when disabled.
- dimension40px
- Base width of the ripple wrapper (before density offset).
- dimension40px
- Base height of the ripple wrapper.
- durationvar(--origam-motion__duration---medium)
- Transition duration for icon/color animations.
Interactif
Playground
Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.
Rendu de l’aperçu en cours…
Usage
Exemples
Extraits de code prêts à coller dans vos templates.
Checkbox use case
Radio use case
Custom input slot
Écosystème
Famille
Composants du même dossier qui partagent les conventions et se composent souvent ensemble.