Skip to content

SCSS Functions

Convenience accessors for CSS custom properties. Each function returns a var(--…) reference, keeping your SCSS decoupled from hardcoded values.

scss
@use '@grundtone/design-tokens/scss/lib' as gt;

.card {
  color: gt.color('text');
  padding: gt.space('lg');
  border-radius: gt.radius('md');
  box-shadow: gt.shadow('sm');
}

color($key)

Returns var(--color-{$key}). Default: 'primary'.

scss
color: gt.color('text-secondary');
border-color: gt.color('border-light');
background: gt.color('surface');

See Colors & Theming for all available color tokens.


font-size($size)

Returns var(--font-size-{$size}). Default: 'base'.

KeyValue
xs0.75rem
sm0.875rem
base1rem
lg1.125rem
xl1.25rem
2xl1.5rem
3xl1.875rem
4xl2.25rem
5xl3rem
scss
.caption { font-size: gt.font-size('sm'); }

font-weight($weight)

Returns var(--font-weight-{$weight}). Default: 'normal'.

KeyValue
thin100
light300
normal400
medium500
semibold600
bold700
extrabold800

font-family($family)

Returns var(--font-family-{$family}). Default: 'base'.

KeyStack
baseIBM Plex Sans + fallback
headingIBM Plex Sans + fallback
monoIBM Plex Mono + fallback

line-height($height)

Returns var(--line-height-{$height}). Default: 'normal'.

KeyValue
none1
tight1.25
snug1.375
normal1.5
relaxed1.625
loose2

space($size)

Returns var(--space-{$size}). Default: 'md'.

KeyValue
xs0.25rem
sm0.5rem
md1rem
lg1.5rem
xl2rem
2xl3rem
3xl4rem
4xl6rem
scss
.stack > * + * { margin-top: gt.space('md'); }

radius($size)

Returns var(--radius-{$size}). Default: 'md'.

KeyValue
none0
xs0.125rem
sm0.25rem
md0.375rem
lg0.5rem
xl0.75rem
2xl1rem
3xl1.5rem
full9999px
scss
.avatar { border-radius: gt.radius('full'); }

shadow($level)

Returns var(--shadow-{$level}). Default: 'md'.

KeyDescription
noneNo shadow
xsSubtle lift
smLight shadow
mdMedium elevation
lgCard/modal elevation
xlHigh elevation
2xlMaximum elevation
innerInset shadow
scss
.card { box-shadow: gt.shadow('sm'); }
.modal { box-shadow: gt.shadow('lg'); }

z-index($layer)

Returns var(--z-{$layer}). Default: 'modal'.

KeyValue
dropdown1000
sticky1020
fixed1030
modal-backdrop1040
modal1050
popover1060
tooltip1070
toast1080
scss
.tooltip { z-index: gt.z-index('tooltip'); }

duration($speed)

Returns var(--duration-{$speed}). Default: 'base'.

KeyValue
fast150ms
base300ms
slow500ms

ease($type)

Returns a timing function CSS var. Default: 'ease-out'.

KeyValue
easecubic-bezier(0.4, 0, 0.2, 1)
ease-incubic-bezier(0.4, 0, 1, 1)
ease-outcubic-bezier(0, 0, 0.2, 1)
ease-in-outcubic-bezier(0.4, 0, 0.2, 1)
linearlinear
scss
.fade {
  transition: opacity gt.duration('fast') gt.ease('ease-out');
}

breakpoint($name)

Returns var(--breakpoint-{$name}).

KeyValue
sm640px
md768px
lg1024px
xl1280px
2xl1536px

For responsive styles, prefer the media-breakpoint-up() mixin from Breakpoints instead of using this function directly.