LinkButton
Text-styled action or link that opens a URL.
- Composed
- New in 0.1
import { LinkButton, linkButtonPrimitive } from "nitro-ui-sdk/link-button";- HeroUI Native
- LinkButton
- Expo UI
- Link

Light 
Dark
On this page
Text that acts: “Terms of Service”, “Forgot password?”, “Read the docs”. It draws in the theme’s link color with no fill. With href it is a link that opens through Linking.openURL; with only onPress it is a button that runs your action. Use Button with variant="ghost" for a borderless action that should look like a button, not like text.
Anatomy
import { LinkButton } from "nitro-ui-sdk/link-button";
export function Anatomy() {
return (
<LinkButton.Root label="Read the docs" href="https://example.com/docs">
<LinkButton.Label />
<LinkButton.Icon />
</LinkButton.Root>
);
}
| Part | Description |
|---|---|
LinkButton.Root |
The native pressable host. Its role is link with href, button without. |
LinkButton.Label |
The visible text. Defaults to label. |
LinkButton.Icon |
A trailing glyph, arrow.up.right by default. |
Without children the root renders Label, then Icon when the destination is external.
Usage
import { View } from "nitro-ui-renderer";
import { LinkButton } from "nitro-ui-sdk/link-button";
export function SignInFooter({ resetPassword }: { resetPassword: () => void }) {
return (
<View layout={{ gap: 8 }}>
<LinkButton.Root label="Forgot password?" onPress={resetPassword} />
<LinkButton.Root label="Privacy Policy" href="https://example.com/privacy" />
</View>
);
}
onPress runs before a destination opens. Call details.preventDefault() to open it yourself, for example in an in-app browser:
import { LinkButton } from "nitro-ui-sdk/link-button";
export function InAppLink({ openInApp }: { openInApp: (url: string) => void }) {
const href = "https://example.com/help";
return (
<LinkButton.Root
label="Help center"
href={href}
onPress={(details) => {
details.preventDefault();
openInApp(href);
}}
/>
);
}
Variants and sizes
There is one look, link: the link color, medium weight, no fill. The press dims the text (opacity.pressed) like links in iOS text.
| Size | Text style | Arrow |
|---|---|---|
sm |
subheadline |
0.75 × the text size |
md (default) |
body |
0.75 × the text size |
lg |
title3 |
0.75 × the text size |
external shows or hides the arrow. It defaults to on for http(s) destinations and off otherwise.
States
- Disabled: dims to
opacity.disabledand refuses every press. - Open failure: when no app can open
href(an unknown scheme or a malformed URL),onOpenErrorreceives the error. The press itself is stillacceptedand nothing throws.
Props
LinkButton.Root
| Prop | Type | Default | Description |
|---|---|---|---|
label |
string |
required | The spoken name. Keep it the same as the visible text so Voice Control finds it. |
href |
string |
— | Destination opened with Linking.openURL. Makes the role link. Required when there is no onPress. |
onPress |
(details: ActionDetails) => void |
— | Runs first. Required when there is no href. |
onOpenError |
(error: unknown) => void |
— | Called when opening href fails. |
external |
boolean |
http(s) → true |
Shows arrow.up.right after the text. |
size |
"sm" | "md" | "lg" |
"md" |
Text style. |
disabled |
boolean |
false |
Refuses every press. |
hint |
string |
— | Accessibility hint. |
haptic |
"light" | "medium" | "heavy" | "none" |
"none" |
Links stay still, like links in iOS text. |
api |
Controller<LinkButtonActions> |
— | From linkButtonPrimitive.createApi(). |
agentId |
string |
— | Stable agent identity. |
confirm |
{ message, approveLabel, cancelLabel } |
— | Asks before an agent presses. |
agentDescription |
string |
— | Optional public description exposed as snapshot text. |
styles |
LinkButtonStyles |
— | Per-part style resolvers. |
layout |
LayoutProps |
— | Layout of the host. |
children |
ReactNode |
— | Custom anatomy. |
LinkButton.Label
| Prop | Type | Default | Description |
|---|---|---|---|
children |
string |
root’s label |
Visible link text. |
part |
LinkButtonPart |
"label" |
Selects the style resolver. |
LinkButton.Icon
| Prop | Type | Default | Description |
|---|---|---|---|
symbol |
string |
"arrow.up.right" |
Trailing SF Symbol. |
fallback |
ImageLoader |
— | Image for Android and missing symbols. |
part |
LinkButtonPart |
"icon" |
Selects the style resolver. |
Controller API
import { useState } from "react";
import { LinkButton, linkButtonPrimitive } from "nitro-ui-sdk/link-button";
export function ShowMore({ expand }: { expand: () => void }) {
const [api] = useState(linkButtonPrimitive.createApi);
return <LinkButton.Root label="Show more" api={api} onPress={expand} />;
}
| Action | Signature | Result |
|---|---|---|
press |
(source?: ActionSource) => ActionStatus |
accepted (opening is asynchronous), disabled or refused (preventDefault()). |
Styles
import { LinkButton, type LinkButtonStyles } from "nitro-ui-sdk/link-button";
const styles: LinkButtonStyles = {
label: ({ tokens }) => ({ text: { color: tokens.colors.accent, fontWeight: "semibold" } }),
};
export function Accent() {
return <LinkButton.Root label="See all" styles={styles} onPress={() => {}} />;
}
Parts: root, label, icon. The resolver receives { tokens, variant: "link", size, state: { disabled } }.
Accessibility
- With
hrefthe element has thelinktrait (“Privacy Policy, link”); without it,button. - Disabled adds
notEnabled. - On iOS, the touch area grows to 44 × 44 pt around short text without moving the layout. On Android, the host reserves a 44 × 44 dp area.
- Inline links in a sentence are separate elements, so each one is reachable on its own.
Agent API
| Action | Arguments | Notes |
|---|---|---|
press |
none | Same controller as touch: runs onPress, then opens href. |
The entry has component: "LinkButton" and role: "link" or "button". The snapshot omits href. Supply agentDescription for public descriptive text, such as “Terms of Service page”.
Platform notes
| iOS | Android | |
|---|---|---|
| Host | KitPressable with the link trait. |
PressableGroup; a link gets the role description “link”. |
| Opening | Linking.openURL (UIApplication.open); failures go to onOpenError. |
Linking.openURL from nitro-ui-core. |
| Verification | Unit, type and iOS harness tests (an unknown scheme reaches onOpenError; no real URL is opened). |
Kotlin implementation is unbuilt here (no Android NDK). |