Skip to content

Design Tokens

Bamboo provides a comprehensive set of design tokens for spacing, transitions, z-index, and shadows. These tokens are defined as CSS custom properties and can be used throughout your application.

Spacing

Spacing tokens are used for consistent sizing and spacing throughout the library.

TokenValuePixels
--size-xs0.75rem12px
--size-sm1rem16px
--size-md1.5rem24px
--size-lg2rem32px
--size-xl3rem48px

Usage

css
.container {
	padding: var(--size-md);
	gap: var(--size-sm);
}

Transitions

Transition tokens define animation durations and timing functions for consistent motion across components.

TokenValue
--transition-fast100ms
--transition-base150ms
--transition-slow300ms
--transition-timingcubic-bezier(0.4, 0, 0.2, 1)

Usage

css
.element {
	transition: all var(--transition-base) var(--transition-timing);
}

Z-Index

Z-index tokens establish a consistent stacking order for layered components.

TokenValuePurpose
--z-base0Default stacking context
--z-elevated1Slightly elevated elements
--z-dropdown1000Dropdown menus
--z-sticky1100Sticky headers/footers
--z-fixed1200Fixed positioning
--z-modal-backdrop1300Modal backdrop overlay
--z-modal1400Modal dialogs
--z-popover1500Popovers and tooltips
--z-tooltip1600Tooltips (highest)

Usage

css
.modal {
	position: fixed;
	z-index: var(--z-modal);
}

.tooltip {
	z-index: var(--z-tooltip);
}

Shadows

Shadow tokens provide consistent elevation and depth throughout the design system.

TokenValue
--shadow-xs0 1px 2px 0 rgb(0 0 0 / 5%)
--shadow-sm0 1px 3px 0 rgb(0 0 0 / 10%), 0 1px 2px -1px rgb(0 0 0 / 10%)
--shadow-md0 4px 6px -1px rgb(0 0 0 / 10%), 0 2px 4px -2px rgb(0 0 0 / 10%)
--shadow-lg0 10px 15px -3px rgb(0 0 0 / 10%), 0 4px 6px -4px rgb(0 0 0 / 10%)
--shadow-xl0 20px 25px -5px rgb(0 0 0 / 10%), 0 8px 10px -6px rgb(0 0 0 / 10%)
--shadow-2xl0 25px 50px -12px rgb(0 0 0 / 25%)

Usage

css
.card {
	box-shadow: var(--shadow-md);
}

.elevated-card {
	box-shadow: var(--shadow-lg);
}

Reference

All tokens are available as CSS custom properties on the :root element and can be used in any CSS context throughout your application.