Skip to content

pantoken-root / renderers/react/src / useToken

Funció: useToken() ​

useToken(name, fallback?): string

Experimental

Hook de React que retorna un valor de token --instui-* resolt (rellegeix en canvi name).

Paràmetres ​

name ​

string

fallback? ​

string = ""

Retorna ​

string

Exemple ​

tsx
import { useToken } from "@pantoken/react";

function Banner() {
  const brand = useToken("--instui-color-background-brand", "#0374B5");
  return <div style={{ background: brand }}>Saved</div>;
}