Skip to content
Cynosurev0.5.0
SearchStorybookGitHubnpmColour mode: System. Switch to Light

Components / Controls

Link

An inline text link that takes the user somewhere. For an action that doesn't navigate, use Button.

Tones are readable

When to useLink to "When to use"

  • Links inside sentences, help text and footers.
  • external for pages outside your product.

Use something else when:

  • it performs an action (save, delete): Button
  • it is a whole clickable panel: Card with href

UsageLink to "Usage"

tsx
Copy
import { Link } from "@arshad-shah/cynosure";

<Link href="/docs">Read the docs</Link>
<Link href="https://example.com" external>Example</Link>
<Link href="mailto:hello@example.com" tone="neutral" size="sm">Email us</Link>

external opens a new tab with a safe rel, adds an external icon and announces "(opens in new tab)" to screen readers. Change that text with labels.external.

Tone and sizeLink to "Tone and size"

tone defaults to accent; text uses each tone's readable text colour. size defaults to inherit, so the link matches the surrounding text; sm, md and lg set a fixed size.

PropsLink to "Props"

Every prop of Link
PropWhat it doesTypeDefault
hrefRequired
Where the link goes.string
childrenRequired
The link text.ReactNode
tone
Colour of the text. Default "accent".Tone"accent"
size
Text size; inherit follows the surrounding text. Default "inherit".Size | "inherit""inherit"
external
Opens in a new tab with a safe rel, an external icon and announced text.boolean
underline
When the underline shows: always (default), hover (on hover and focus) or none. Leave it on in running text, where the underline is what tells a link from the words around it; take it off only where the place says it is a link (a navigation bar, a footer's columns, a card title)."none" | "always" | "hover"
aria-current
Marks the link as the current item of a set, e.g. "page" for the page being shown in a navigation bar.boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time"
onClick
Called when the link is activated.MouseEventHandler<HTMLAnchorElement>
labels
Replace the built-in English text: external is read out after a link that opens in a new tab.{ external?: string; }
className
Added to the root element, for layout.string
style
Layout only.CSSProperties

Generated from the type definitions in @arshad-shah/cynosure 0.5.0.

Behaviour and accessibilityLink to "Behaviour and accessibility"

Behaviour and accessibility, table 1
InputResult
Click, EnterFollows the link, or calls onClick
TabFocus with a visible ring
  • Safe schemes: href may be relative, http(s), mailto or tel. Other schemes are not linked.
  • Ref: the ref points at the anchor.

ThemingLink to "Theming"

Tokens: --cy-link-underline-offset and --cy-link-underline-thickness.

ts
Copy
createTheme({ components: { link: { underlineThickness: "2px" } } });

Button · Card

These examples run Cynosure 0.5.0 (commit 50ce30b), the version on npm.

Getting started
Theming
Icons
Accessibility
Code editors and highlighters
Using Cynosure without React
Build-tool adapters
Components
Accordion
AppShell
AspectRatio
Breadcrumbs
Calendar
Card
Container
Disclosure
Divider
DocumentViewport
Grid
Inline
PageHeader
PanZoomCanvas
ScrollArea
SideNav
SortableList
SplitPane
Stack
StatusBar
Tabs
TitleBar
Toolbar
Tree
VirtualList
ZoomControls
Announcer
Avatar
Badge
CodeBlock
DescriptionList
EmptyState
ErrorBoundary
Field
Heading
IconTile
Image
Kbd
List
LoadingDots
Notice
ProgressBar
Prose
Skeleton
Stat
Steps
Table
Text
Button
Checkbox
Checklist
ColorField
ColorSwatches
Combobox
CompareSlider
CopyButton
DateField
FileDrop
IconButton
KeyValueEditor
Link
NumberField
Pagination
PathField
RadioGroup
SearchField
SegmentedControl
Select
SelectionFrame
SignaturePad
Slider
Switch
TagInput
TextArea
TextField
ThemeToggle
TimeField
ButtonBase
ChoiceBase
DialogBase
FileInputBase
HiddenValue
Icon
InputBase
LinkBase
LiveRegion
TextAreaBase
ChatMessage
Choice
DataGrid
DeviceFrame
HighlightedText
HotkeyField
ListRow
OptionList
OverlayFrame
QRCode
RowActions
Section
SiteFooter
SiteHeader
SkipLink
SortButton
VisuallyHidden
CommandPalette
ContextMenu
Dialog
FloatingToolbar
HoverCard
Menu
Menubar
Popover
ProgressOverlay
Sheet
Toast
Tooltip
Changelog