Packages

@twind/core › PropsOf

@twind/core.PropsOf

Ƭ PropsOf<T>: T extends Style<infer Variants> ? { [key in keyof Variants]: MorphVariant<keyof Variants[key]> } : never

Allows to extract the supported properties of a style function.

Here is an example for react

js
import { HTMLAttributes } from "react";
import { style, PropsOf } from "@twind/core";
const button = style({ ... })
type ButtonProps = PropsOf<typeof button>
export const Button = (props: ButtonProps & HTMLAttributes<HTMLButtonElement>) => {
  return <button className={style(props)} {...rest} />
}

Type parameters

Name
T

Defined in

packages/core/src/style.ts:51