Notice
A quiet line of text with a coloured dot, for something worth knowing: done, be careful, or gone wrong.
Saved. Your changes are live.
Trial ends in 3 days. Add a card to keep going.
Payment failed. Check the card and try again.
Options
Code
import "./notice.css";
export function Notice({ kind, title, children }) {
return (
<p className="dh-notice" data-kind={kind} role={kind === "bad" ? "alert" : "status"}>
<span>
{title && <b>{title} </b>}
{children}
</span>
</p>
);
}
export function Example() {
return (
<div className="dh-notice-stack">
<Notice kind="good" title="Saved.">Your changes are live.</Notice>
<Notice kind="warn" title="Trial ends in 3 days.">Add a card to keep going.</Notice>
<Notice kind="bad" title="Payment failed.">Check the card and try again.</Notice>
</div>
);
}.dh-notice-stack {
display: grid;
gap: 0.4em;
width: 18em;
max-width: 100%;
}
.dh-notice {
--hue: #8a8a8a;
display: flex;
gap: 0.65em;
margin: 0;
padding: 0.55em 0.8em;
border-radius: 0.6em;
background: var(--dh-well, #ededeb);
color: var(--dh-muted, #5c5c5c);
font-size: 0.875em;
line-height: 1.45;
text-align: left;
}
.dh-notice::before {
content: "";
flex: none;
width: 0.45em;
height: 0.45em;
margin-top: 0.5em;
border-radius: 50%;
background: var(--hue);
}
.dh-notice b {
color: var(--dh-fg, #171717);
font-weight: 500;
}
.dh-notice[data-kind="good"] {
--hue: #1fa750;
}
.dh-notice[data-kind="warn"] {
--hue: #e39b0b;
}
.dh-notice[data-kind="bad"] {
--hue: #d92d20;
}<div class="dh-notice-stack">
<p class="dh-notice" data-kind="good"><span><b>Saved.</b> Your changes are live.</span></p>
<p class="dh-notice" data-kind="warn"><span><b>Trial ends in 3 days.</b> Add a card to keep going.</span></p>
<p class="dh-notice" data-kind="bad"><span><b>Payment failed.</b> Check the card and try again.</span></p>
</div>.dh-notice-stack {
display: grid;
gap: 0.4em;
width: 18em;
max-width: 100%;
}
.dh-notice {
--hue: #8a8a8a;
display: flex;
gap: 0.65em;
margin: 0;
padding: 0.55em 0.8em;
border-radius: 0.6em;
background: var(--dh-well, #ededeb);
color: var(--dh-muted, #5c5c5c);
font-size: 0.875em;
line-height: 1.45;
text-align: left;
}
.dh-notice::before {
content: "";
flex: none;
width: 0.45em;
height: 0.45em;
margin-top: 0.5em;
border-radius: 50%;
background: var(--hue);
}
.dh-notice b {
color: var(--dh-fg, #171717);
font-weight: 500;
}
.dh-notice[data-kind="good"] {
--hue: #1fa750;
}
.dh-notice[data-kind="warn"] {
--hue: #e39b0b;
}
.dh-notice[data-kind="bad"] {
--hue: #d92d20;
}Notice is not in the Figma file yet.
Use the React or HTML code for now.