React hooks
Typed React hooks for built design tokens or live Figma Variables API access.
npm install @primitree/hooks@next react@^19.0.0 swr@^2.3.7@primitree/hooks requires Node.js 24 or newer and React ^19.0.0.
The package has two data paths:
- Local tokens read files from
primitree build - Live API hooks read or change variables through the Enterprise Variables REST API with SWR
Local tokens
TokensProvider, useToken, useTheme
Live API
useVariables and mutations
Migration from 4.x
Package changes in 1.0
Non-React usage
Framework-agnostic utilities live in @primitree/core, including the normalizer, fetcher, and diff functions.