React 19 hooks library and CLI for the official Figma Variables REST API. Type-safe synchronization between Figma and React apps with 100% test coverage.
Test coverage with Vitest ensuring reliability for production use
Full TypeScript support with Zod validation for runtime safety
MIT licensed and actively maintained for the design systems community
Design systems teams using Figma Variables faced a critical workflow challenge: there was no official way to programmatically access Figma's design variables from React applications. This created:
When Figma released their Variables REST API in 2024, I saw an opportunity to build the missing piece: a React hooks library that made Figma Variables a first-class citizen in React development.
FigmaVars Hooks is a React 19 hooks library that provides type-safe access to the Figma Variables REST API, paired with a CLI tool for exporting variables into CI/CD pipelines.
Built custom React hooks that fetch and cache Figma variables at runtime:
useFigmaVariables() - Fetch all variables from a Figma fileuseFigmaVariable() - Get a specific variable by ID or nameuseFigmaCollection() - Access variable collectionsCreated figma-vars-export CLI for exporting Figma variables as JSON in CI/CD pipelines:
All API responses are validated at runtime using Zod schemas, ensuring type safety beyond TypeScript's compile-time checks. This prevents runtime errors from malformed API data and provides clear error messages when validation fails.
Built comprehensive test suite with Vitest covering:
Leveraged React 19's new capabilities:
Optimized for DX:
Enables powerful workflows:
FigmaVars Hooks bridges the gap between Figma Variables and React development:
The library is published on npm, actively maintained, and serves as a foundation for teams building design token workflows with Figma Variables.