BtnGroup

Form & Input
stable

Groups Btn elements into a connected segmented control. Propagates density, color and hover/active state to child buttons via OrigamDefaultsProvider.

Structure

Anatomie

Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.

Anatomy of OrigamBtnGroupSchematic of the BtnGroup component with 3 numbered internal parts. origam-btn origam-btn origam-btn 1 2 3 origam-btn-group border-inline-end (divided)
Anatomy of <origam-btn-group> — root container ① (role="group"), OrigamDefaultsProvider ② wrapping child buttons ③. With divided, a border-inline-end separates adjacent buttons.
1.origam-btn-group
Root element (default: <div>, role="group"). inline-flex, overflow: hidden, vertical-align: middle. Carries border, elevation and rounding classes. Child buttons are forced border-radius: 0 and box-shadow: none via :deep.
2.origam-btn-group--divided
Modifier applied when divided=true. Adds a border-inline-end between non-last child buttons.
3(origam-btn children)
Child <origam-btn> elements. Receive density, color, bgColor, hover, active defaults from the group via OrigamDefaultsProvider. Individual children can override these defaults.

API

Props

Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.

divided
boolean
false
Shows a thin border between adjacent buttons (border-inline-end on each non-last child).
items
Array<IBtnProps>
[]
Array of props objects to render OrigamBtn instances programmatically. Ignored when the default slot is used.
tag
string
'div'
HTML element rendered at the root. Carries role="group" for accessibility.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
Border-radius token for the group container. Child buttons are forced border-radius: 0 via :deep so only the group corners are rounded (overflow: hidden clips the rest).
roundedTopRight
boolean | number | string
roundedTopLeft
boolean | number | string
roundedBottomLeft
boolean | number | string
roundedBottomRight
boolean | number | string
roundedStartStart
boolean | number | string
roundedStartEnd
boolean | number | string
roundedEndStart
boolean | number | string
roundedEndEnd
boolean | number | string
border
boolean | number | string | TDirectionBoth | Array<TDirectionBoth>
false
Applies a border around the entire group container.
borderTop
boolean | number | string
borderLeft
boolean | number | string
borderBottom
boolean | number | string
borderRight
boolean | number | string
borderBlock
boolean | number | string
borderInline
boolean | number | string
borderInlineStart
boolean | number | string
borderInlineEnd
boolean | number | string
borderBlockStart
boolean | number | string
borderBlockEnd
boolean | number | string
borderColor
string
Override border color for the group container.
borderStyle
string
borderTopColor
TColor
borderRightColor
TColor
borderBottomColor
TColor
borderLeftColor
TColor
borderInlineStartColor
TColor
borderInlineEndColor
TColor
borderBlockStartColor
TColor
borderBlockEndColor
TColor
density
'default'
Density propagated to all child buttons via OrigamDefaultsProvider. Affects group min-height.
elevation
TElevation
Box-shadow elevation for the group container. Child buttons have box-shadow: none forced via :deep.
color
Foreground color propagated to all child buttons as a default.
bgColor
Background color propagated to all child buttons as a default.
margin
boolean | number | string
marginTop
boolean | number | string
marginLeft
boolean | number | string
marginBottom
boolean | number | string
marginRight
boolean | number | string
marginBlock
boolean | number | string
marginInline
boolean | number | string
marginInlineStart
boolean | number | string
marginInlineEnd
boolean | number | string
marginBlockStart
boolean | number | string
marginBlockEnd
boolean | number | string
padding
boolean | number | string
paddingTop
boolean | number | string
paddingLeft
boolean | number | string
paddingBottom
boolean | number | string
paddingRight
boolean | number | string
paddingBlock
boolean | number | string
paddingInline
boolean | number | string
paddingInlineStart
boolean | number | string
paddingInlineEnd
boolean | number | string
paddingBlockStart
boolean | number | string
paddingBlockEnd
boolean | number | string
hover
boolean | IStateEffectConfig
Hover state override propagated to child buttons via OrigamDefaultsProvider.
hoverClass
string
active
boolean | IStateEffectConfig
false
Active state override propagated to child buttons via OrigamDefaultsProvider.
activeClass
string
variant
TVariant
size
TSize | number

API

Slots

Emplacements de contenu exposés par ce composant.

#default
Content area for OrigamBtn (or BtnToggle) children. When provided, the items prop is ignored.
#item
Override rendering of each item from the items array. Receives the IBtnProps object and its index.

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 child components. Used by OrigamBtnToggle to proxy group props.
Ref<string>
Reactive CSS string generated by useStyle from the computed btnGroupStyles.
string
Unique style-sheet ID for this instance.
() => void
Injects the computed style sheet into the document.
() => void
Removes the injected style sheet.
Ref<boolean>
True once the style sheet has been injected into the DOM.

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.

Reference height used to compute min-height with density offset.
Density offset. comfortable: +8px, default: 0px, compact: −8px.
Group container border-radius. Overridden by rounded modifier classes.
Group border width. Set to "thin" when border=true.
Group border style.
Group border color (currentColor by default).
Group background color.
Group foreground color (inherited by default).

Inclusion

Accessibilité

Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.

Rôles ARIA

group

Interactions clavier

Interactions clavier
ToucheAction
TabMoves focus through each button in the group sequentially.
Enter / SpaceActivates the focused button.

Notes

  • The root element always carries role="group". Consider adding aria-label or aria-labelledby to describe the group purpose (e.g. "Text alignment").
  • Child buttons inside the group share adjacent borders (border-inline-end suppressed on non-last, border-inline-start on non-first). This ensures no double borders visually while keeping each button individually focusable.

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.

Source
dimension
var(--origam-radius---sm)
Default border radius for the group container.
dimension
var(--origam-border__width---0)
Default border width (none until border prop is set).

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.

Basic group

vue

Divided group

vue

From items array

vue

Écosystème

Famille

Composants du même dossier qui partagent les conventions et se composent souvent ensemble.