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 { Link } from '@flexi-ui/link'
A simple link to navigate between pages:
Choose from various color schemes to match your design:
Links come in three sizes to fit different contexts:
Control when the underline appears with different underline variants:
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:
Make links display as block elements to take up full width:
Prevent link interaction with the isDisabled prop:
The Link component works seamlessly with popular routing libraries.
Use the Link component with Next.js routing:
Use with React Router's Link component:
Use with Remix's Link component:
Customize links with additional CSS classes:
Add custom icons to your links:
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:
Prop Type Default Description 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
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
The Link component is built with accessibility in mind and follows WAI-ARIA best practices.
Try navigating with your keyboard:
Links automatically include appropriate ARIA attributes:
Provide descriptive link text for screen readers:
Bad - Non-descriptive
For more information,
click here
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
Always use clear, descriptive text that explains where the link goes or what action it performs:
Always mark external links with isExternal and consider using showAnchorIcon:
Choose underline variants that match your design and improve usability:
Ensure links have enough contrast with surrounding text:
Maintain consistency across your application:
Ensure links are large enough for touch interaction (minimum 44x44px):
Match link colors to their meaning and context:
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:
Problem : Custom className styles are being overridden.
Solution : Use Tailwind's modifier classes or increase specificity:
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
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