Build beautiful apps
Start

Link

The Link component provides accessible navigation with support for external links, custom styling, and seamless integration with popular routing libraries like Next.js, React Router, and Remix.

Import

import { Link } from '@flexi-ui/link'

Usage

A simple link to navigate between pages:

Colors

Choose from various color schemes to match your design:

Color in Context

Visit our documentation to learn more.

Check the latest updates for new features.

Report an issue if you encounter problems.

Sizes

Links come in three sizes to fit different contexts:

Sizes with Colors

Underline Variants

Control when the underline appears with different underline variants:

Underline with Colors

Links to external websites can be marked with the isExternal prop:

Display an external link icon to indicate the link opens in a new tab:

FlexiUI is built with React and TypeScript. Check out the

React documentation

and

TypeScript documentation

for more information.

Make links display as block elements to take up full width:

Documentation

Learn how to use FlexiUI

Read the docs →

Examples

Explore example projects

View examples →

Community

Join our community

Get involved →

Disabled State

Prevent link interaction with the isDisabled prop:

Disabled State Comparison

Framework Integration

The Link component works seamlessly with popular routing libraries.

Next.js Integration

Use the Link component with Next.js routing:

Next.js with Styling

React Router Integration

Use with React Router's Link component:

Remix Integration

Use with Remix's Link component:

Custom Styling

Customize links with additional CSS classes:

Custom Icons

Add custom icons to your links:

Real-World Examples

A complete navigation menu with links:

Create breadcrumb navigation with links:

A comprehensive footer with organized links:

Cards featuring multiple links:

Getting Started

Everything you need to start building with FlexiUI.

A sidebar menu with active state indication:

Links naturally integrated into content:

API Reference

PropTypeDefaultDescription
hrefstring-The URL to navigate to (required)
color'foreground' | 'primary' | 'secondary' | 'success' | 'warning' | 'error''primary'The color theme of the link
size'sm' | 'md' | 'lg''md'The size of the link
underline'none' | 'hover' | 'always' | 'active' | 'focus''none'When to show the underline
isExternalbooleanfalseWhether the link opens in a new tab. Automatically adds target="_blank" and rel="noopener noreferrer"
showAnchorIconbooleanfalseWhether to show an external link icon (only works with isExternal)
isDisabledbooleanfalseWhether the link is disabled. Disables click events and adds aria-disabled
isBlockbooleanfalseWhether the link should display as a block element
asElementType'a'The component to render as (useful for framework integration)
classNamestring-Additional CSS classes to apply
childrenReactNode-The content of the link

Additional HTML Props

The Link component also accepts all standard HTML anchor (<a>) attributes:

  • target - Where to open the linked document
  • rel - Relationship between current and linked document
  • download - Specifies that the target will be downloaded
  • hrefLang - Language of the linked document
  • referrerPolicy - Referrer policy for the link
  • And all other standard anchor attributes

Accessibility

The Link component is built with accessibility in mind and follows WAI-ARIA best practices.

Keyboard Navigation

ARIA Attributes

Links automatically include appropriate ARIA attributes:

Screen Reader Support

Provide descriptive link text for screen readers:

Bad - Non-descriptive

For more information,

click here

Good - Descriptive

Read the full documentation

for more information.

Key Accessibility Features

  • Semantic HTML: Uses native <a> elements for proper semantics
  • Keyboard Support: Fully accessible via keyboard (Tab, Enter, Space)
  • Focus Indicators: Clear visual focus states for keyboard navigation
  • ARIA Attributes: Appropriate aria-disabled, aria-label, and other ARIA attributes
  • External Link Security: Automatically adds rel="noopener noreferrer" for external links
  • Screen Reader Friendly: Descriptive link text and proper announcements
  • Color Contrast: All color variants meet WCAG AA standards
  • Disabled State: Properly communicated to assistive technologies

Best Practices

Always use clear, descriptive text that explains where the link goes or what action it performs:

Avoid generic text

Click here

Use descriptive text

Learn more about our features

Always mark external links with isExternal and consider using showAnchorIcon:

3. Use Appropriate Underline Styles

Choose underline variants that match your design and improve usability:

For body text links, use

hover underline

to indicate interactivity.

For navigation menus, use

no underline

for a cleaner look.

4. Maintain Sufficient Color Contrast

Ensure links have enough contrast with surrounding text:

This paragraph contains a

well-contrasted link

that's easy to distinguish from surrounding text.

5. Use Consistent Navigation Patterns

Maintain consistency across your application:

6. Consider Mobile Touch Targets

Ensure links are large enough for touch interaction (minimum 44x44px):

7. Use Semantic Colors

Match link colors to their meaning and context:

Troubleshooting

Problem: Links reload the page instead of using client-side navigation.

Solution: Use the as prop to integrate with your router:

Use the 'as' prop with your router's Link component

Problem: External links open in the same tab despite using isExternal.

Solution: Ensure you're using the isExternal prop correctly:

Problem: Disabled links can still be clicked and navigated.

Solution: The isDisabled prop adds aria-disabled and prevents default behavior, but ensure your event handlers respect this:

Custom Styles Not Applied

Problem: Custom className styles are being overridden.

Solution: Use Tailwind's modifier classes or increase specificity:

Anchor Icon Not Showing

Problem: External link icon doesn't appear despite using showAnchorIcon.

Solution: Ensure you also set isExternal:

Incorrect - icon won't show

Link

Correct - both props needed

Link

Focus Outline Not Visible

Problem: Focus outline is hard to see on certain backgrounds.

Solution: Use the underline="focus" variant or custom focus styles:

  • Button - For actions and form submissions
  • Breadcrumbs - For hierarchical navigation
  • Menu - For dropdown navigation
  • Tabs - For tabbed navigation