Link
const Link: ForwardRefExoticComponent<LinkProps & RefAttributes<LinkHandle>>;Focusable hyperlink for terminal UIs.
Renders link text (or custom children) and opens the URL in the default browser when the user presses Space or Enter. Focusable by default and can be disabled.
Examples
Section titled “Examples”<Link href="https://example.com">Visit Example</Link>// Minimal — displays the URL as text<Link href="https://github.com" />// Styled link<Link href="https://docs.example.com" style={{ color: "blue", underline: true }} focusedStyle={{ color: "cyan", bold: true }}> Documentation</Link>Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
children? | ReactNode | Custom content. When absent, the href is displayed as text. |
disabled? | boolean | When true, the link is skipped in the focus order and ignores input. |
focusable? | boolean | Whether the link is focusable (default: true). |
focusedStyle? | Style | Style applied when the link is focused (merged with style). |
href | string | The URL to open when the link is activated. |
onOpen? | () => void | Called after the URL has been opened. |
style? | Style | Base style for the link container. |
LinkHandle
Section titled “LinkHandle”Handle for Link
Extends
Section titled “Extends”Methods
Section titled “Methods”blur()
Section titled “blur()”blur(): void;Programmatically blur (unfocus) this element
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”focus()
Section titled “focus()”focus(): void;Programmatically focus this element
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”scrollIntoView()
Section titled “scrollIntoView()”scrollIntoView(options?): void;Scroll the nearest parent ScrollView to make this element visible.
Behaves like the DOM Element.scrollIntoView() method.
No-op if the element is not inside a ScrollView.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
options? | ScrollIntoViewOptions | Alignment options (default: { block: "nearest" }) |
Returns
Section titled “Returns”void
Example
Section titled “Example”const inputRef = useRef<InputHandle>(null);
// Minimal scroll — just enough to make it visibleinputRef.current?.scrollIntoView();
// Center the element in the viewportinputRef.current?.scrollIntoView({ block: "center" });Inherited from
Section titled “Inherited from”FocusableHandle.scrollIntoView
Properties
Section titled “Properties”| Property | Modifier | Type | Description | Inherited from |
|---|---|---|---|---|
isFocused | readonly | boolean | Whether this element is currently focused | FocusableHandle.isFocused |