Button Library · Basic
Link
A real anchor that looks like a link.
An <a>: set href to your page.
States
Default
Hover
Active
Focus
Code
link.html
<a class="btn-link" href="#"> <span>Get started</span> </a>
link.css
.btn-link {
--btn-bg: #7c5cff;
--btn-fg: #8b6cff;
--btn-font: inherit;
--btn-size: 15px;
--btn-weight: 600;
--btn-w: auto;
--btn-h: auto;
--btn-bw: 0px;
--btn-line: #8b6cff;
--btn-shadow: none;
--btn-speed: 180ms;
}
.btn-link {
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5em;
box-sizing: border-box;
width: var(--btn-w);
height: var(--btn-h);
padding: 0;
font-family: var(--btn-font);
font-size: var(--btn-size);
font-weight: var(--btn-weight);
line-height: 1.2;
color: var(--btn-fg);
background: transparent;
border: var(--btn-bw) solid var(--btn-line);
border-radius: 2px;
box-shadow: var(--btn-shadow);
cursor: pointer;
text-decoration: none;
white-space: nowrap;
transition: all var(--btn-speed) ease;
}
.btn-link:focus-visible {
outline: 2px solid var(--btn-bg);
outline-offset: 2px;
}
.btn-link:disabled {
opacity: 0.5;
pointer-events: none;
}
.btn-link__icon {
width: 1.15em;
height: 1.15em;
flex-shrink: 0;
}
.btn-link:hover {
text-decoration: underline;
text-underline-offset: 4px;
}
@media (prefers-reduced-motion: reduce) {
.btn-link {
animation: none !important;
transition: none !important;
}
}
link.js
// No JavaScript needed: this one is CSS only.
link.tsx
import type React from "react";
import "./link.css"; // the CSS tab
export function BtnLink({ children = "Get started", ...props }: React.ComponentProps<"a">) {
return (
<a className="btn-link" href="#" {...props}>
<span>{children}</span>
</a>
);
}
link.html
<a class="relative inline-flex items-center justify-center gap-[0.5em] [box-sizing:border-box] [padding:0] [font-family:inherit] text-[15px] font-[600] [line-height:1.2] text-[#8b6cff] [background:transparent] [border:0px_solid_#8b6cff] rounded-[2px] [box-shadow:none] cursor-pointer no-underline whitespace-nowrap [transition:all_180ms_ease] focus-visible:[outline:2px_solid_#7c5cff] focus-visible:[outline-offset:2px] disabled:[opacity:0.5] disabled:[pointer-events:none] hover:[text-decoration:underline] hover:[text-underline-offset:4px] motion-reduce:[transition:none!important]" href="#"> <span>Get started</span> </a>