digdir / designsystemet

Designsystemet
https://designsystemet.no
MIT License
78 stars 36 forks source link

Move to `data-size` and `data-color` and expose on all components #2671

Closed eirikbacker closed 2 hours ago

eirikbacker commented 2 hours ago

Description

Since all components (and HTML elements) will support data-size and data-color, we should expose this as props also in React and thus avoiding confusion on when size is available and when it is not. We can however provide type safety by creating a shared props definition, which all components can extend:

type SharedProps = {
  /** Recommended sizes */
  'data-size'?: 'sm' | 'md' | 'xl';
  'data-color'?: 'red' | 'blue' | (string & {});
}

and

type AccordionProps = SharedProps & { ... }

Additional Information

No response

eirikbacker commented 2 hours ago

Duplicate of #2655