• Start

  • Blogg

  • Kom igång

  • Riktlinjer

  • Komponenter

  • Changelog

  • Tillgänglighet

  • Statistik

  • Inställningar

Komponenter

Komponenter

​
​

Inga resultat hittade, prova med andra sökvillkor.

Checkbox

Checkbox

3.4.0

Checkboxes can be used to turn an option on or off.

Demo
Props
Installation
Länkar
Best practices
Tillgänglighet
Change log
Statistik

Demo

Props

Se fullständing dokumentation(öppnas i ny flik)
NamnTypBeskrivning

customAttribute

{ attribute: string; value: string | number }Used for tests. Clickable and requested subcomponents will be suffixed with "-[ComponentName]".

isLoading

booleanIf true, a loading skeleton will be rendered instead of the component.

Installation

Kodexempel
npm install @sj-ab/component-library.ui.checkbox

Länkar

  • Storybook

  • Figma

  • Bit.cloud

Best practices

Examples

Checkbox with label

Checkbox with label

List Item with Checkbox (leading)

List Item with Checkbox (leading)

List Item with Checkbox (trailing)

List Item with Checkbox (trailing)

Tillgänglighet

Semantik

Checkbox presenteras som en helt vanlig HTML <input type="checkbox">.

Textetiketter

Använd komponenten FormControlLabel för att koppla ihop Checkbox med en textetikett. FormControlLabel hanterar automatiskt kopplingen mellan <input> och <label> och ser till att användare med skärmläsare får rätt uppläsning.

Kodexempel

Läs mer om FormControlLabel hos MaterialUI

Gruppera formulärsobjekt

Grupper med kryssrutor, radioknappar eller andra formulärsobjekt ska alltid grupperas i koden, så att skärmläsaranvändare förstår att de hänger ihop. Detta kan göras med WAI-ARIA-attributen role="group" och aria-label eller aria-labelledby:

Kodexempel

Change log

  • Updated design token colors

    3.4.0
  • Adds new focus-visible markings.

    3.3.0
  • Upgrade to React 19

    3.2.0
  • Remove form control label hover effect from non touch devices

    3.1.4

Statistik