• Start
  • Blogg
  • Kom igång
  • Riktlinjer
  • Komponenter
  • Changelog
  • Tillgänglighet
  • Inställningar

Komponenter

Komponenter

​
​

Inga resultat hittade, prova med andra sökvillkor.

Chip

Chip

9.0.1

The Chip component is a compact element that represents an input, attribute, or action.

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

Demo

Props

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

ariaLabel

stringAria label attribute for enhanced accessibility.

customAttribute

{ attribute: string; value: string | number }Add this for testing. Clickable and requested subcomponents will get suffixed with "-[ComponentName]".

disabled

booleanIf true, the component is disabled.

elevation

"undefined" | "1" | "2"Elevation of the chip. Used primarily in dark mode to handle modals and layers.

id

stringA unique identifier for the component. Used internally for setting WAI-ARIA relationships.

label *

stringThe label text.

loading

booleanIf true, displays a loading skeleton instead of the chip content.

onClick

(event: MouseEvent) => voidCallback fired when chip is clicked.

selected

booleanIf true, shows the chip in a visually selected state.

startIcon

FCLeading icon in the chip.

sx

SxPropsCustom styles applied to the chip.

Installation

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

Länkar

  • Storybook

  • Figma

  • Bit.cloud

Tillgänglighet

Semantik

Chip presenteras som en <div> om den inte är interaktiv, eller som en knapp (<button type="button">) när den är interaktiv och har fått en klicklyssnare med onClick.

Vald eller inte vald?

Ett klickbart Chip kan markeras som vald med attributet selected. Komponenten får då en check-ikon och markeras automatiskt som vald för hjälpmedel med aria-pressed="true".

Förtydligande uppläsning för skärmläsare

Som standard får Chip ett namn av den synliga texten inuti komponenten.

Det är dock möjligt att skriva över den synliga texten med attributet ariaLabel om man vill förtydliga för användare som inte ser. Det kan till exempel gälla ett chip som används som filter i tidtabellen och vi vill förtydliga att ett filter är aktivt.

Change log

  • Update Design Tokens

    9.0.0

    Breaking

  • Align endIcon and clickable delete icon in Chip

    8.0.1
  • Remove checkmark from selected chip

    8.0.0

    Breaking

  • Cleaning up ADO resources and manually moved ADO 94399

    7.1.4
  • Migrate to ESLint 9

    7.1.2

Statistik

  • Importer av Chip

    52
  • Repos med Chip

    41%
  • Senaste installerade version av Chip

    4.6.2
  • Äldsta installerade version av Chip

    1.1.6