digdir / designsystemet

Designsystemet
https://designsystemet.no
MIT License
74 stars 37 forks source link

"Component tokens" component #2513

Open mimarz opened 2 hours ago

mimarz commented 2 hours ago

Make an internal component that automates documentation of a components "component tokens" to be used in Storybook (and Storefront in the future).

Notes:

Something along the lines of: Input CSS:


.ds-button {
  --dsc-button-background--active: var(--ds-color-accent-base-active); /** Button background */
  …
}

Component use:

import css from '@digidr/designsystemet-css/button'

<ComponentTokens css={css} />
Rendered table: Token Description Value
--dsc-button-background--active Button background var(--ds-color-accent-base-active)
Barsnes commented 2 hours ago

I like this, but we should probably filter on --dsc-, and mark our internal variables with something like --dsci- (i for internal`)

eirikbacker commented 1 hour ago

Agree! Like the concept - good work 💪 and marking internal is a good suggestion @Barsnes 🙌