{
  "component": "Link",
  "package": "@blade-ai/weft",
  "status": "stable",
  "version": "0.1.0",
  "updated": "2026-11-24",
  "import": "import { Link } from \"@blade-ai/weft/components/link\";",
  "docs": "/components/link",
  "description": "A text link. Renders a native <a href> for navigation and falls back to a <button> only when there is no href. Anchor links sit inside running text and are always underlined; button links stand alone.",
  "props": [
    {
      "name": "children",
      "type": "string",
      "default": null,
      "required": true,
      "description": "Link text. Says where the link goes, two to five words."
    },
    {
      "name": "href",
      "type": "string",
      "default": null,
      "required": false,
      "description": "Destination. Renders a native <a href>. Without href the link renders a <button> (in-page actions only)."
    },
    {
      "name": "target",
      "type": "\"_self\" | \"_blank\"",
      "default": "_self",
      "required": false,
      "description": "\"_blank\" opens a new tab and adds the external icon plus a visually hidden \"(opens in new tab)\"."
    },
    {
      "name": "rel",
      "type": "string",
      "default": "auto",
      "required": false,
      "description": "Link relationship. Set to \"noopener noreferrer\" automatically when target is _blank."
    },
    {
      "name": "variant",
      "type": "\"anchor\" | \"button\"",
      "default": "anchor",
      "required": false,
      "description": "anchor: inside text, always underlined. button: standalone, underlined on hover."
    },
    {
      "name": "color",
      "type": "\"primary\" | \"neutral\" | \"white\"",
      "default": "primary",
      "required": false,
      "description": "primary (green) for most links, neutral inside dense UI, white on dark surfaces."
    },
    {
      "name": "size",
      "type": "\"small\" | \"medium\" | \"large\"",
      "default": "medium",
      "required": false,
      "description": "Type size 12 / 14 / 16px. Inline anchors should match the surrounding text size."
    },
    {
      "name": "icon",
      "type": "IconComponent",
      "default": null,
      "required": false,
      "description": "Icon shown with the label, aria-hidden. One icon per link."
    },
    {
      "name": "iconPosition",
      "type": "\"left\" | \"right\"",
      "default": "left",
      "required": false,
      "description": "Icon before or after the label. External links use right."
    },
    {
      "name": "isDisabled",
      "type": "boolean",
      "default": false,
      "required": false,
      "description": "Removes href and sets aria-disabled=\"true\". Whether it applies to the anchor variant is UNDEFINED · needs decision."
    },
    {
      "name": "onClick",
      "type": "(event) => void",
      "default": null,
      "required": false,
      "description": "Click handler. Not called when isDisabled."
    },
    {
      "name": "accessibilityLabel",
      "type": "string",
      "default": null,
      "required": false,
      "description": "Accessible name (aria-label) when the visible text alone is not enough. Must start with the visible text."
    },
    {
      "name": "htmlTitle",
      "type": "string",
      "default": null,
      "required": false,
      "description": "Native tooltip text. Never the only place for important information."
    },
    {
      "name": "testID",
      "type": "string",
      "default": null,
      "required": false,
      "description": "Test hook, rendered as data-testid."
    }
  ],
  "undefined": [
    "Pressed colour (no Theme token; hover is reused)",
    "Hover / pressed colour for color=\"white\"",
    "Whether isDisabled applies to variant=\"anchor\"",
    "Whether a disabled link stays in the tab order (it drops its href, so it leaves it)",
    "Visited style (the old Weft Link had none)",
    "Colour transition (no motion tokens in the file)",
    "Minimum touch target for standalone links on mobile",
    "Focus border on dark surfaces"
  ],
  "sizes": {
    "fontSize": "small --typography-fonts-size-75 · medium --typography-fonts-size-100 · large --typography-fonts-size-200",
    "lineHeight": "small --typography-line-heights-50 · medium --typography-line-heights-100 · large 24px literal (no token)",
    "fontWeight": "--typography-fonts-weight-medium",
    "iconSize": "small --size-12 · medium --size-14 · large --size-16",
    "iconGap": "--spacing-2",
    "underline": "1px · offset --size-3",
    "ringRadius": "--border-radius-none",
    "padding": "0 (the text sets the size); 1px transparent border at rest",
    "icons": "chevron (back) or external arrow from the icon set, fill = icon token of the state, aria-hidden; one icon per link"
  },
  "states": [
    {
      "name": "default · anchor primary",
      "trigger": "resting",
      "tokens": {
        "text": "interactive.text.primary.normal",
        "decoration": "underline 1px",
        "icon": "interactive.icon.primary.normal"
      }
    },
    {
      "name": "default · button primary",
      "trigger": "resting",
      "tokens": {
        "text": "interactive.text.primary.normal",
        "decoration": "none",
        "icon": "interactive.icon.primary.normal"
      }
    },
    {
      "name": "default · neutral",
      "trigger": "resting",
      "tokens": {
        "text": "interactive.text.gray.normal",
        "decoration": "per variant",
        "icon": "interactive.icon.gray.normal"
      }
    },
    {
      "name": "default · white",
      "trigger": "resting, on dark surfaces",
      "tokens": {
        "text": "interactive.text.staticWhite.normal",
        "decoration": "per variant",
        "icon": "interactive.icon.staticWhite.normal"
      }
    },
    {
      "name": "hover · anchor primary",
      "trigger": "pointer over",
      "tokens": {
        "text": "interactive.text.gray.normal",
        "decoration": "underline 1px",
        "icon": "interactive.icon.gray.normal"
      }
    },
    {
      "name": "hover · button primary",
      "trigger": "pointer over",
      "tokens": {
        "text": "interactive.text.primary.normal",
        "decoration": "underline 1px",
        "icon": "interactive.icon.primary.normal"
      }
    },
    {
      "name": "hover · neutral",
      "trigger": "pointer over",
      "tokens": {
        "text": "interactive.text.gray.muted",
        "decoration": "underline 1px",
        "icon": "interactive.icon.gray.muted"
      }
    },
    {
      "name": "hover · white",
      "trigger": "pointer over",
      "tokens": {
        "text": "UNDEFINED · needs decision",
        "decoration": "underline 1px",
        "icon": "UNDEFINED"
      }
    },
    {
      "name": "focus-visible · all",
      "trigger": "keyboard focus",
      "tokens": {
        "text": "same as default",
        "decoration": "1px interactive.border.primary.default + 3px ring interactive.border.primary.faded",
        "icon": "same as default"
      }
    },
    {
      "name": "focus-visible · white",
      "trigger": "keyboard focus",
      "tokens": {
        "text": "same as default",
        "decoration": "1px interactive.border.staticWhite.default",
        "icon": "same as default"
      }
    },
    {
      "name": "pressed · all",
      "trigger": "pointer down",
      "tokens": {
        "text": "UNDEFINED · needs decision (hover reused)",
        "decoration": "as hover",
        "icon": "UNDEFINED (hover reused)"
      }
    },
    {
      "name": "disabled · all",
      "trigger": "isDisabled",
      "tokens": {
        "text": "same as default",
        "decoration": "opacity 50% (--opacity-600)",
        "icon": "same as default"
      }
    }
  ],
  "behaviour": {
    "navigate": "href set: render <a href>; click or Enter navigates.",
    "noHref": "No href: render <button type=\"button\">; onClick only.",
    "external": "target=\"_blank\": add rel=\"noopener noreferrer\", the external arrow icon, and hidden \"(opens in new tab)\".",
    "disabled": "isDisabled: drop href, aria-disabled=\"true\", ignore clicks, opacity 50%.",
    "underline": "anchor: always underlined. button: underline on hover only.",
    "focus": ":focus-visible only; 1px primary border + 3px ring (as Chip); transparent 1px border at rest.",
    "pressedColour": "UNDEFINED · needs decision (Blade Link has none).",
    "whiteHover": "UNDEFINED · needs decision for color = white.",
    "disabledAnchor": "UNDEFINED · does isDisabled apply to variant = anchor?",
    "disabledFocus": "UNDEFINED · does a disabled link stay in the tab order?",
    "visited": "UNDEFINED · no visited style in the old Weft Link.",
    "motion": "UNDEFINED · colour transition; no motion tokens in the file.",
    "ringContrast": "Resolved: 1px border gives 19.90:1 on white; ring alone is 1.55:1.",
    "touchTarget": "UNDEFINED · minimum target for standalone links on mobile."
  },
  "keyboard": [
    {
      "key": "Tab / Shift+Tab",
      "action": "Moves focus to and from the link; ring shows (:focus-visible)."
    },
    {
      "key": "Enter",
      "action": "<a href> follows the link. <button> fallback runs onClick."
    },
    {
      "key": "Space",
      "action": "<a href>: nothing. <button> fallback: runs onClick on release."
    },
    {
      "key": "Click",
      "action": "Follows the link or runs onClick. Ignored when disabled."
    },
    {
      "key": "Shift+Enter",
      "action": "Browser default: opens in a new window."
    }
  ],
  "accessibility": {
    "summary": "Native link and button behaviour; no custom key handling. Markup: <a href>{icon}{children}<span class=\"sr-only\">(opens in new tab)</span></a>, or <button type=\"button\"> without href.",
    "aria": [
      {
        "element": "a",
        "attributes": "href",
        "when": "destination; removed when disabled"
      },
      {
        "element": "a",
        "attributes": "target",
        "when": "\"_blank\" for external links"
      },
      {
        "element": "a",
        "attributes": "rel",
        "when": "\"noopener noreferrer\" when target is _blank"
      },
      {
        "element": "a",
        "attributes": "aria-label",
        "when": "accessibilityLabel, only when set"
      },
      {
        "element": "a",
        "attributes": "title",
        "when": "htmlTitle, only when set"
      },
      {
        "element": "span.sr-only",
        "attributes": "text",
        "when": "\"(opens in new tab)\" when target is _blank"
      },
      {
        "element": "a (disabled)",
        "attributes": "aria-disabled=\"true\"",
        "when": "isDisabled; href removed"
      },
      {
        "element": "button (no href)",
        "attributes": "type=\"button\"",
        "when": "Always"
      },
      {
        "element": "icon svg",
        "attributes": "aria-hidden=\"true\"",
        "when": "Always"
      },
      {
        "element": "a",
        "attributes": "data-testid",
        "when": "testID"
      }
    ]
  },
  "usage": {
    "do": [
      "Use a native <a href> for navigation; fall back to <button> only without href.",
      "Underline every link inside running text (variant = anchor).",
      "Add the external arrow, rel=\"noopener noreferrer\" and hidden \"(opens in new tab)\" to external links.",
      "Write link text that names the destination, two to five words.",
      "Use Theme tokens for colour and Global tokens for size; no component tokens."
    ],
    "dont": [
      "Don't use a link for actions that change data; use Button.",
      "Don't make Space follow an <a href>.",
      "Don't show the ring on mouse click.",
      "Don't use \"click here\" or link a whole sentence.",
      "Don't use any product name but Blade AI in sample copy."
    ]
  },
  "example": "<Link href=\"https://blade.ai/docs\" target=\"_blank\">Read the docs</Link>"
}
