Skip to content

Router that virtually distributes inference across connected devices in the home.

Go
19.9 KB
Raw Blame

Anchor

Also known as: Link

A styled anchor element that provides consistent link styling across applications.

Examples

Basic Anchor

<Flex gap="2">
    <Anchor href="/" kind="inline">
        Inline
    </Anchor>
    <Anchor href="/" kind="standalone">
        Standalone
    </Anchor>
</Flex>

Custom Link Component

Use asChild to render framework specific link components with our styling

<Anchor asChild>
    <NextLink href="/">Home</NextLink>
</Anchor>

Disabled Anchor

A disabled anchor will render as a span instead of an anchor tag

<Anchor disabled href="/">
    Disabled Link
</Anchor>

As Button

Render Anchor as a button for non-navigation tasks

<Anchor asChild>
    <button onClick={() => console.log('Button clicked')} type="button">
        View Details
    </button>
</Anchor>

Props

Prop Type Default Description
asChild boolean - When true, renders the immediate child instead of the default element, merging this component's props with the child's props.
disabled boolean false Whether the anchor is disabled. When true, the Anchor will render as a span instead of an anchor tag. Note: if using asChild, you may want your component to handle the disabled state instead. In that case pass disabled to your component directly instead of to the Anchor component.
fontFamily "sans" | "mono" - The font family of the text.
fontSize "10" | "12" | "14" | "16" | "18" | "20" | "22" | "24" | "28" | "32" | "36" | "40" | "44" | "48" | "50" | "56" | "60" | "64" | "72" | "80" - The font size of the text.
fontStyle "normal" | "italic" - The font style of the text.
fontWeight "bold" | "light" | "regular" | "semibold" - The font weight of the text.
kind "inline" | "standalone" "inline" The kind of anchor to render. Defaults to "inline" which is intended to be used within text(renders a underline). Use "standalone" for Anchors rendered outside of prose(as a CTA for example) - it renders without a underline.
lineHeight "100" | "125" | "150" | "175" - The line-height of the text.
textKind "inherit" | "body/bold/2xl" | "body/bold/3xl" | "body/bold/lg" | "body/bold/md" | "body/bold/xl" | "body/bold/sm" | "body/bold/xs" | "body/regular/lg" | "body/regular/md" | "body/regular/sm" | "body/regular/xl" | "body/regular/2xl" | "body/regular/3xl" | "body/regular/xs" | "body/semibold/2xl" | "body/semibold/3xl" | "body/semibold/lg" | "body/semibold/md" | "body/semibold/sm" | "body/semibold/xl" | "body/semibold/xs" | "display/2xl" | "display/xl" | "display/lg" | "display/md" | "display/sm" | "display/xs" | "label/bold/2xl" | "label/bold/3xl" | "label/bold/lg" | "label/bold/md" | "label/bold/sm" | "label/bold/xl" | "label/bold/xs" | "label/light/lg" | "label/light/xl" | "label/light/2xl" | "label/light/3xl" | "label/light/md" | "label/light/sm" | "label/light/xs" | "label/regular/lg" | "label/regular/md" | "label/regular/sm" | "label/regular/xs" | "label/regular/xl" | "label/regular/2xl" | "label/regular/3xl" | "label/semibold/lg" | "label/semibold/md" | "label/semibold/sm" | "label/semibold/xl" | "label/semibold/2xl" | "label/semibold/3xl" | "label/semibold/xs" | "mono/md" | "mono/sm" | "mono/lg" | "mono/xl" | "mono/2xl" | "title/2xl" | "title/xl" | "title/lg" | "title/md" | "title/sm" | "title/xs" "body/regular/md" The Text typography kind to render as - defaults to "body/regular/md" so it will align with text when rendered inline with text. For standalone Anchors, prefer a "label" typography family.
underline boolean - Whether or not the text should be underlined.