Skip to content

pantoken / renderers/react/src / useToken

Feidhm: useToken()

useToken(name, fallback?): string

Turgnamhach

Hook React a thugann luach token --instui-* réitithe ar ais (léann sé arís nuair a athraíonn name).

Paraiméadair

name

string

fallback?

string = ""

Tuairisceáin

string

Sampla

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

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