Links

The link base component provides a set of base-styles and classes to style links consistently across your application. It includes various states and modifiers to handle different link types and interactions.

Base element

The base <a> element is styled by default with no need for classes.

Variants

By default, there are no variants available for links.

If you are compiling your own version of Graupl, you can set the $themeable variable to true to enable variants.

States

Links handle the following states by default: visited, focus, hover, active, disabled, selected, and current (though not all will have visual differences out-of-the-box).

You can manually apply these states with the helper classes .visited, .focus, .hover, .active and .disabled, respectively.

Select the link state you would like displayed.

Custom Properties

The following custom properties can be used to customize the link element:

PropertyDescriptionDefault Value
--graupl-link-text-decorationThe text decoration for the link component.underline
--graupl-link-visited-text-decorationThe text decoration for a visited link component.var(--graupl-link-text-decoration)
--graupl-link-focus-text-decorationThe text decoration for a focused link component.var(--graupl-link-text-decoration)
--graupl-link-hover-text-decorationThe text decoration for a hovered link component.underline
--graupl-link-active-text-decorationThe text decoration for an active link component.var(--graupl-link-hover-text-decoration)
--graupl-link-disabled-text-decorationThe text decoration for a disabled link component.underline
--graupl-link-text-decoration-thicknessThe text decoration thickness for the link component.var(--graupl-border-width)
--graupl-link-visited-text-decoration-thicknessThe text decoration thickness for a visited link component.var(--graupl-link-text-decoration-thickness)
--graupl-link-focus-text-decoration-thicknessThe text decoration thickness for a focused link component.var(--graupl-link-text-decoration-thickness)
--graupl-link-hover-text-decoration-thicknessThe text decoration thickness for a hovered link component.var(--graupl-border-width)
--graupl-link-active-text-decoration-thicknessThe text decoration thickness for an active link component.var(--graupl-link-hover-text-decoration-thickness)
--graupl-link-disabled-text-decoration-thicknessThe text decoration thickness for a disabled link component.var(--graupl-border-width)
--graupl-link-text-decoration-styleThe text decoration style for the link component.solid
--graupl-link-visited-text-decoration-styleThe text decoration style for a visited link component.var(--graupl-link-text-decoration-style)
--graupl-link-focus-text-decoration-styleThe text decoration style for a focused link component.var(--graupl-link-text-decoration-style)
--graupl-link-hover-text-decoration-styleThe text decoration style for a hovered link component.solid
--graupl-link-active-text-decoration-styleThe text decoration style for an active link component.var(--graupl-link-hover-text-decoration-style)
--graupl-link-disabled-text-decoration-styleThe text decoration style for a disabled link component.solid
--graupl-link-colorThe color for the link component.var(--graupl-theme-active--primary--700)
--graupl-link-visited-colorThe color for a visited link component.var(--graupl-link-color)
--graupl-link-focus-colorThe color for a focused link component.var(--graupl-link-color)
--graupl-link-hover-colorThe color for a hovered link component.var(--graupl-theme-active--tertiary--700)
--graupl-link-active-colorThe color for an active link component.var(--graupl-link-hover-color)
--graupl-link-disabled-colorThe color for a disabled link component.var(--graupl-theme-active--primary--200)
--graupl-link-text-decoration-colorThe text decoration color for the link component.var(--graupl-link-color)
--graupl-link-visited-text-decoration-colorThe text decoration color for a visited link component.var(--graupl-link-visited-color)
--graupl-link-focus-text-decoration-colorThe text decoration color for a focused link component.var(--graupl-link-focus-color)
--graupl-link-hover-text-decoration-colorThe text decoration color for a hovered link component.var(--graupl-link-hover-color)
--graupl-link-active-text-decoration-colorThe text decoration color for an active link component.var(--graupl-link-active-color)
--graupl-link-disabled-text-decoration-colorThe text decoration color for a disabled link component.var(--graupl-link-disabled-color)
--graupl-link-backgroundThe background color for the link component.transparent
--graupl-link-visited-backgroundThe background color for a visited link component.var(--graupl-link-background)
--graupl-link-focus-backgroundThe background color for a focused link component.var(--graupl-link-background)
--graupl-link-hover-backgroundThe background color for a hovered link component.transparent
--graupl-link-active-backgroundThe background color for an active link component.var(--graupl-link-hover-background)
--graupl-link-disabled-backgroundThe background color for a disabled link component.transparent
--graupl-link-padding-xThe horizontal padding for the link component.var(--graupl-spacer-0)
--graupl-link-padding-yThe vertical padding for the link component.var(--graupl-spacer-0)
--graupl-link-paddingThe padding for the link component (combines x and y padding).var(--graupl-link-padding-y) var(--graupl-link-padding-x)
--graupl-link-transitionThe transition for the link component.background var(--graupl-transition-duration-fast) var(--graupl-transition-timing-function), color var(--graupl-transition-duration-fast) var(--graupl-transition-timing-function), transform var(--graupl-transition-duration-fast) var(--graupl-transition-timing-function)
--graupl-link-transition-reduced-motionThe transition for the link component when reduced motion is enabled.background var(--graupl-transition-duration-none) var(--graupl-transition-timing-function), color var(--graupl-transition-duration-none) var(--graupl-transition-timing-function)
--graupl-link-transformThe transform for the link component.none
--graupl-link-visited-transformThe transform for a visited link component.var(--graupl-link-transform)
--graupl-link-focus-transformThe transform for a focused link component.var(--graupl-link-transform)
--graupl-link-hover-transformThe transform for a hovered link component.none
--graupl-link-active-transformThe transform for an active link component.var(--graupl-link-hover-transform)
--graupl-link-disabled-transformThe transform for a disabled link component.none
--graupl-link-border-top-widthThe top border width for the link component.0
--graupl-link-border-right-widthThe right border width for the link component.0
--graupl-link-border-bottom-widthThe bottom border width for the link component.0
--graupl-link-border-left-widthThe left border width for the link component.0
--graupl-link-border-widthThe border width for the link component (combines top, right, bottom, and left widths).var(--graupl-link-border-top-width) var(--graupl-link-border-right-width) var(--graupl-link-border-bottom-width) var(--graupl-link-border-left-width)
--graupl-link-border-top-styleThe top border style for the link component.var(--graupl-border-top-style)
--graupl-link-border-right-styleThe right border style for the link component.var(--graupl-border-right-style)
--graupl-link-border-bottom-styleThe bottom border style for the link component.var(--graupl-border-bottom-style)
--graupl-link-border-left-styleThe left border style for the link component.var(--graupl-border-left-style)
--graupl-link-border-styleThe border style for the link component (combines top, right, bottom, and left styles).var(--graupl-link-border-top-style) var(--graupl-link-border-right-style) var(--graupl-link-border-bottom-style) var(--graupl-link-border-left-style)
--graupl-link-border-top-left-radiusThe top left border radius for the link component.var(--graupl-border-top-left-radius)
--graupl-link-border-top-right-radiusThe top right border radius for the link component.var(--graupl-border-top-right-radius)
--graupl-link-border-bottom-right-radiusThe bottom right border radius for the link component.var(--graupl-border-bottom-right-radius)
--graupl-link-border-bottom-left-radiusThe bottom left border radius for the link component.var(--graupl-border-bottom-left-radius)
--graupl-link-border-radiusThe border radius for the link component (combines top-left, top-right, bottom-right, and bottom-left radii).var(--graupl-link-border-top-left-radius) var(--graupl-link-border-top-right-radius) var(--graupl-link-border-bottom-right-radius) var(--graupl-link-border-bottom-left-radius)
--graupl-link-border-colorThe border color for the link component.transparent
--graupl-link-visited-border-colorThe border color for a visited link component.var(--graupl-link-border-color)
--graupl-link-focus-border-colorThe border color for a focused link component.var(--graupl-link-border-color)
--graupl-link-hover-border-colorThe border color for a hovered link component.transparent
--graupl-link-active-border-colorThe border color for an active link component.var(--graupl-link-hover-border-color)
--graupl-link-disabled-border-colorThe border color for a disabled link component.transparent
--graupl-link-min-widthThe minimum width for the link component.auto
--graupl-link-min-heightThe minimum height for the link component.auto
--graupl-stretched-link-z-indexThe z-index for the stretched link component modifier.5

Sass variables

The following Sass variables can be used to customize the generation of the link component:

VariableDescriptionDefault Value
$selector-baseThe selector base for the component.""
$modifier-selector-baseThe selector base for component modifiers."."
$generate-base-theme-mapFlag to generate the base theme maps for link variants.true
$themeableFlag to generate theme modifiers.false
$link-selector-baseThe base selector for the link component.""
$link-selectorThe selector for the link component."a"
$link-theme-prefix-selector-baseSelector base used for link theme modifiers."."
$link-theme-prefix-selectorSelector prefix used for link theme modifiers.""
$stretched-link-selector-baseThe base selector for the stretched link component modifier."."
$stretched-link-selectorThe selector for the stretched link component modifier."stretched"
$stretched-link-pseudo-selectorThe pseudo selector for the stretched link component modifier."before"
$link-initial-text-decorationThe initial text decoration for the link component.underline
$link-final-text-decorationThe final text decoration for the link component.underline
$link-disabled-text-decorationThe disabled text decoration for the link component.underline
$link-initial-text-decoration-styleThe initial text decoration style for the link component.solid
$link-final-text-decoration-styleThe final text decoration style for the link component.solid
$link-disabled-text-decoration-styleThe disabled text decoration style for the link component.solid
$link-initial-transformThe initial transform for the link component.none
$link-final-transformThe final transform for the link component.none
$link-disabled-transformThe disabled transform for the link component.none
$link-border-widthThe border width for the link component.0
$link-min-widthThe minimum width for the link component.auto
$link-min-heightThe minimum height for the link component.auto
$stretched-link-z-indexThe z-index for the stretched link component modifier.5
$link-theme-mappingsMap of properties and shade values applied to themed links.map.merge($-link-theme-mappings, $link-theme-mappings)
$link-theme-mapFully expanded property map used to generate themed links.map.deep-merge($-link-theme-map, $link-theme-map)