-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
Description
Description
Is it possible to get the styles of a component from the theme's design token?
For example, below the user is setting styles for the input below.
const Example = () => {
const NBInput = Factory(TextInput);
return <NBInput placeholder="Click on the button" borderWidth="1" borderColor="cyan.400" borderRadius="md" />;
};
Where it would make more sense to get the styles from the theme's design token for a TextInput (e.g. outlined text input variant).
<NBInput placeholder="Click on the button" ref={inputRef} borderWidth={inputStyles.borderWidth} borderColor={inputStyles.borderColor} borderRadius={inputStyles.borderRadius} />
I have tried tried useToken, but I can't actually access the styles I believe
const [token] = useToken('components', ['Input.variants.filled']);
Problem Statement
If it doesn't already exist, it should exist so custom components can refer to the styling of the theme, so when the theme does update the component will update, as opposed to updating the individual component .
Proposed Solution or API
const [styles] = useToken('components', ['Input.variants.filled.baseStyles']);
Alternatives
No response
Additional Information
No response