Skip to content
Discussion options

You must be logged in to vote

https://github.com/joe-bell/cva#variantprops

You can use VariantProps to extract the type, and then pick off the type like a standard object (YourType[‘intent’])

// components/button.ts
import type { VariantProps } from "class-variance-authority";
import { cva } from "class-variance-authority";

/**
 * Button
 */
export type ButtonProps = VariantProps<typeof button>;
export type ButtonIntent = ButtonProps['intent']

export const button = cva(/* … */);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by joe-bell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants