Rim button
A glossy button with a thin brushed-metal rim, in a colour and in white. The arrow nudges forward on hover.
Options
Code
import "./rim-button.css";
const arrow = (
<svg viewBox="0 0 24 24" fill="none" aria-hidden="true">
<path d="M4 12H20M14 18L20 12L14 6" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round" />
</svg>
);
/* white gives the pale version. withArrow adds the arrow that nudges forward on hover. */
export function RimButton({ white = false, withArrow = false, children, ...rest }) {
return (
<button className={"dh-rim-button" + (white ? " dh-rim-button--white" : "")} type="button" {...rest}>
{children}
{withArrow && arrow}
</button>
);
}.dh-rim-button {
--dh-rim-button-colour: var(--dh-accent, #2f66e0);
display: inline-flex;
align-items: center;
gap: 0.5em;
height: 2.9em;
padding: 0 1.15em;
/* The rim: a strip of brushed metal showing round a fill that stops short of the edge. */
border: 1.5px solid transparent;
border-radius: 0.8em;
background:
linear-gradient(in oklab, color-mix(in oklab, var(--dh-rim-button-colour), #fff 18%), color-mix(in oklab, var(--dh-rim-button-colour), #000 24%)) padding-box,
linear-gradient(in oklab 160deg, #fff 0%, #b7b9c1 26%, #f7f7f9 48%, #9a9ca5 72%, #e3e4e8 100%) border-box;
box-shadow:
inset 0 1px 0 rgb(255 255 255 / 0.35),
inset 0 -1px 0 rgb(0 0 0 / 0.18),
0 1px 2px rgb(0 0 0 / 0.12),
0 0.7em 1.5em -0.7em color-mix(in srgb, var(--dh-rim-button-colour) 70%, #000);
color: var(--dh-on-accent, #fff);
font-family: inherit;
font-size: 0.875em;
font-weight: 550;
line-height: 1;
letter-spacing: -0.01em;
white-space: nowrap;
cursor: pointer;
transition: transform 150ms cubic-bezier(0.23, 1, 0.32, 1), filter 150ms cubic-bezier(0.23, 1, 0.32, 1);
}
.dh-rim-button svg {
width: 1em;
height: 1em;
transition: transform 200ms cubic-bezier(0.23, 1, 0.32, 1);
}
.dh-rim-button--white {
background:
linear-gradient(#fff, #f6f6f7) padding-box,
linear-gradient(in oklab 160deg, #fff 0%, #b7b9c1 26%, #f7f7f9 48%, #9a9ca5 72%, #e3e4e8 100%) border-box;
box-shadow:
inset 0 1px 0 #fff,
inset 0 -1px 0 rgb(0 0 0 / 0.04),
0 1px 2px rgb(0 0 0 / 0.12),
0 0.7em 1.5em -0.7em rgb(4 12 48 / 0.5);
color: #151515;
font-weight: 500;
}
.dh-rim-button:active {
transform: scale(0.97);
}
.dh-rim-button:focus-visible {
outline: 2px solid var(--dh-faint, #8a8a8a);
outline-offset: 3px;
}
@media (hover: hover) {
.dh-rim-button:hover {
filter: brightness(1.07);
}
.dh-rim-button--white:hover {
filter: brightness(0.98);
}
.dh-rim-button:hover svg {
transform: translateX(2px);
}
}
@media (prefers-reduced-motion: reduce) {
.dh-rim-button,
.dh-rim-button svg {
transition: none;
}
}
/* The preview's layout. */
.dh-rim-row {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 0.7em;
}<div class="dh-rim-row">
<button class="dh-rim-button" type="button">Start free trial<svg viewBox="0 0 24 24" fill="none" aria-hidden="true"><path d="M4 12H20M14 18L20 12L14 6" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
<button class="dh-rim-button dh-rim-button--white" type="button">Book a demo</button>
</div>.dh-rim-button {
--dh-rim-button-colour: var(--dh-accent, #2f66e0);
display: inline-flex;
align-items: center;
gap: 0.5em;
height: 2.9em;
padding: 0 1.15em;
/* The rim: a strip of brushed metal showing round a fill that stops short of the edge. */
border: 1.5px solid transparent;
border-radius: 0.8em;
background:
linear-gradient(in oklab, color-mix(in oklab, var(--dh-rim-button-colour), #fff 18%), color-mix(in oklab, var(--dh-rim-button-colour), #000 24%)) padding-box,
linear-gradient(in oklab 160deg, #fff 0%, #b7b9c1 26%, #f7f7f9 48%, #9a9ca5 72%, #e3e4e8 100%) border-box;
box-shadow:
inset 0 1px 0 rgb(255 255 255 / 0.35),
inset 0 -1px 0 rgb(0 0 0 / 0.18),
0 1px 2px rgb(0 0 0 / 0.12),
0 0.7em 1.5em -0.7em color-mix(in srgb, var(--dh-rim-button-colour) 70%, #000);
color: var(--dh-on-accent, #fff);
font-family: inherit;
font-size: 0.875em;
font-weight: 550;
line-height: 1;
letter-spacing: -0.01em;
white-space: nowrap;
cursor: pointer;
transition: transform 150ms cubic-bezier(0.23, 1, 0.32, 1), filter 150ms cubic-bezier(0.23, 1, 0.32, 1);
}
.dh-rim-button svg {
width: 1em;
height: 1em;
transition: transform 200ms cubic-bezier(0.23, 1, 0.32, 1);
}
.dh-rim-button--white {
background:
linear-gradient(#fff, #f6f6f7) padding-box,
linear-gradient(in oklab 160deg, #fff 0%, #b7b9c1 26%, #f7f7f9 48%, #9a9ca5 72%, #e3e4e8 100%) border-box;
box-shadow:
inset 0 1px 0 #fff,
inset 0 -1px 0 rgb(0 0 0 / 0.04),
0 1px 2px rgb(0 0 0 / 0.12),
0 0.7em 1.5em -0.7em rgb(4 12 48 / 0.5);
color: #151515;
font-weight: 500;
}
.dh-rim-button:active {
transform: scale(0.97);
}
.dh-rim-button:focus-visible {
outline: 2px solid var(--dh-faint, #8a8a8a);
outline-offset: 3px;
}
@media (hover: hover) {
.dh-rim-button:hover {
filter: brightness(1.07);
}
.dh-rim-button--white:hover {
filter: brightness(0.98);
}
.dh-rim-button:hover svg {
transform: translateX(2px);
}
}
@media (prefers-reduced-motion: reduce) {
.dh-rim-button,
.dh-rim-button svg {
transition: none;
}
}
/* The preview's layout. */
.dh-rim-row {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 0.7em;
}Rim button is not in the Figma file yet.
Use the React or HTML code for now.