38 / 51
All 51 in 51 Tailwind CSS Buttons
- 01Tailwind Submit Button (Form Primary)
- 02Tailwind Primary and Secondary Button Pair
- 03Tailwind Ghost / Outline Button
- 04Tailwind Icon-Only Button with Accessible Tooltip
- 05Tailwind Gradient CTA Button
- 06Tailwind Loading Spinner Button (State Transition)
- 07Tailwind Disabled Button State (Full State Reference)
- 08Tailwind Button Group Component (Segmented Radio-Like)
- 09Tailwind Add to Cart Button
- 10Tailwind Download Progress Button
- 11Tailwind Like Heart Button
- 12Tailwind Confirm Delete Button
- 13Tailwind Play Pause Button
- 14Tailwind Subscribe Confetti Button
- 15Tailwind Magnetic Mercury Ripple Button
- 16Tailwind Brutalist Glitch Button
- 17Tailwind Neon Plasma Burst Button
- 18Tailwind Clay Press Button
- 19Tailwind Editorial Ink Spread Button
- 20Tailwind Particle Shard Burst Button
- 21Tailwind Brushed Brass Plate Button
- 22Tailwind Washi Paper Crane Button
- 23Tailwind Frosted Ice Cube Button
- 24Tailwind Vintage Typewriter Key Button
- 25Tailwind Lacquered Walnut Wood Button
- 26Tailwind Pharma Gel Capsule Button
- 27Tailwind Aged Copper Coin Button
- 28Tailwind Origami Fortune Cookie Button
- 29Tailwind Holographic Foil Sticker Button
- 30Tailwind Brutalist Concrete Slab Button
- 31Tailwind Mercury Bead Morph Button
- 32Tailwind Soft Pill Modern SaaS Button
- 33Tailwind Masking Tape Label Button
- 34Tailwind Obsidian Glass Shard Button
- 35Tailwind Wine Velvet Ribbon Button
- 36Tailwind LED Segment Display Button
- 37Tailwind Cassette Mixtape Label Button
- 38Tailwind Chalkboard Menu Button
- 39Tailwind Vinyl Record Sleeve Ripple Button
- 40Tailwind Polaroid Snapshot Button
- 41Tailwind Airline Boarding Pass Button
- 42Tailwind Aged Brass Subway Token Button
- 43Tailwind Vintage Rx Pharmacy Label Button
- 44Tailwind Bakelite Radio Dial Toggle Button
- 45Tailwind Regal Postage Stamp Button
- 46Tailwind Victorian Cigar Band Foil Button
- 47Tailwind Vintage Calculator Key Button
- 48Tailwind Toolbox Latch Spotlight Button
- 49Tailwind Receipt Paper Total Count-Up Button
- 50Tailwind IBM Punch Card Magnetic Follow Button
- 51Tailwind Brass Periscope Lens Button
Tailwind Chalkboard Menu Button
Slate with real chalk behaviour: a dusty uneven board, a hand-drawn double border, letterforms that sit in the tooth of the surface, and a puff of chalk dust when you press. Hover wipes a faint smudge across the board.
Untitled UI Pro: 5,000+ React + Tailwind CSS v4 components · from $349 one-time
Untitled UI React · Affiliate link
The code
<div class="tb-38 w-full min-h-svh grid place-items-center font-tb38-hand p-[clamp(1.5rem,6vw,4rem)]">
<button type="button" class="tb-38__board group relative cursor-pointer grid place-items-center min-h-17 px-11 border-2 border-dashed border-tb38-chalk-52 rounded-lg text-2xl tracking-[0.02em] shadow-[0_16px_26px_-16px_#000000cc,inset_0_0_30px_#00000059] transition-[translate,box-shadow] duration-[220ms] ease-tb38-out [-webkit-tap-highlight-color:transparent] before:content-[''] before:absolute before:inset-1.5 before:pointer-events-none before:border before:border-dashed before:border-tb38-chalk-28 before:rounded-[0.35rem] before:rotate-[0.25deg] hover:-translate-y-0.5 focus-visible:-translate-y-0.5 focus-visible:outline-2 focus-visible:outline-offset-[5px] focus-visible:outline-tb38-chalk active:translate-y-px active:shadow-[0_6px_12px_-10px_#000000cc,inset_0_0_36px_#00000073] disabled:cursor-not-allowed disabled:opacity-55 motion-reduce:transition-none">
<span aria-hidden="true" class="absolute inset-0 z-20 pointer-events-none opacity-0 bg-[linear-gradient(104deg,transparent_30%,rgba(244,241,230,0.1)_50%,transparent_70%)] transition-opacity duration-[400ms] group-hover:opacity-100 group-focus-visible:opacity-100 motion-reduce:transition-none"></span>
<span aria-hidden="true" class="absolute left-1/2 -bottom-2 w-32 h-5 -ml-16 rounded-[50%] pointer-events-none opacity-0 blur-[4px] bg-[radial-gradient(closest-side,rgba(244,241,230,0.6),transparent_74%)] group-active:animate-tb38-dust motion-reduce:hidden"></span>
<span class="relative z-30 text-tb38-chalk-92 [text-shadow:0_0_1px_var(--color-tb38-chalk-55),0_0_7px_var(--color-tb38-chalk-20),0_1px_0_#00000059]">Today's special</span>
</button>
</div><div class="tb-38 w-full min-h-svh grid place-items-center font-tb38-hand p-[clamp(1.5rem,6vw,4rem)]">
<button type="button" class="tb-38__board group relative cursor-pointer grid place-items-center min-h-17 px-11 border-2 border-dashed border-tb38-chalk-52 rounded-lg text-2xl tracking-[0.02em] shadow-[0_16px_26px_-16px_#000000cc,inset_0_0_30px_#00000059] transition-[translate,box-shadow] duration-[220ms] ease-tb38-out [-webkit-tap-highlight-color:transparent] before:content-[''] before:absolute before:inset-1.5 before:pointer-events-none before:border before:border-dashed before:border-tb38-chalk-28 before:rounded-[0.35rem] before:rotate-[0.25deg] hover:-translate-y-0.5 focus-visible:-translate-y-0.5 focus-visible:outline-2 focus-visible:outline-offset-[5px] focus-visible:outline-tb38-chalk active:translate-y-px active:shadow-[0_6px_12px_-10px_#000000cc,inset_0_0_36px_#00000073] disabled:cursor-not-allowed disabled:opacity-55 motion-reduce:transition-none">
<span aria-hidden="true" class="absolute inset-0 z-20 pointer-events-none opacity-0 bg-[linear-gradient(104deg,transparent_30%,rgba(244,241,230,0.1)_50%,transparent_70%)] transition-opacity duration-[400ms] group-hover:opacity-100 group-focus-visible:opacity-100 motion-reduce:transition-none"></span>
<span aria-hidden="true" class="absolute left-1/2 -bottom-2 w-32 h-5 -ml-16 rounded-[50%] pointer-events-none opacity-0 blur-[4px] bg-[radial-gradient(closest-side,rgba(244,241,230,0.6),transparent_74%)] group-active:animate-tb38-dust motion-reduce:hidden"></span>
<span class="relative z-30 text-tb38-chalk-92 [text-shadow:0_0_1px_var(--color-tb38-chalk-55),0_0_7px_var(--color-tb38-chalk-20),0_1px_0_#00000059]">Today's special</span>
</button>
</div>@import "tailwindcss";
@theme {
--color-tb38-bg: #20242b;
--color-tb38-bg: oklch(0.26 0.015 265);
--color-tb38-slate: #26302f;
--color-tb38-slate: oklch(0.3 0.015 175);
--color-tb38-slate-2: #1b2322;
--color-tb38-slate-2: oklch(0.23 0.015 175);
--color-tb38-chalk: #f4f1e6;
--color-tb38-chalk: oklch(0.96 0.01 90);
--color-tb38-chalk-92: #f4f1e6eb;
--color-tb38-chalk-92: oklch(0.96 0.01 90 / 0.92);
--color-tb38-chalk-55: #f4f1e68c;
--color-tb38-chalk-55: oklch(0.96 0.01 90 / 0.55);
--color-tb38-chalk-52: #f4f1e685;
--color-tb38-chalk-52: oklch(0.96 0.01 90 / 0.52);
--color-tb38-chalk-28: #f4f1e647;
--color-tb38-chalk-28: oklch(0.96 0.01 90 / 0.28);
--color-tb38-chalk-20: #f4f1e633;
--color-tb38-chalk-20: oklch(0.96 0.01 90 / 0.2);
--font-tb38-hand: "Patrick Hand", ui-rounded, "Comic Sans MS", cursive;
--ease-tb38-out: cubic-bezier(0.16, 1, 0.3, 1);
--animate-tb38-dust: tb-38-dust 0.6s ease-out;
}
@keyframes tb-38-dust {
0% {
opacity: 0.75;
scale: 0.4 0.5;
}
100% {
opacity: 0;
scale: 1.6 1.4;
}
}
.tb-38 {
width: 100%;
min-height: 100vh;
min-height: 100svh;
background: repeating-linear-gradient(92deg, rgba(0,0,0,.05) 0 2px, transparent 2px 9px), var(--color-tb38-bg);
}
/* THE SLATE: two dust speckle tiles, two broad washes, and the base. */
.tb-38__board {
background-color: var(--color-tb38-slate);
background-image: radial-gradient(.08rem .08rem at 24% 36%, rgba(244,241,230,.2) 99%, transparent), radial-gradient(.06rem .06rem at 68% 72%, rgba(244,241,230,.16) 99%, transparent), radial-gradient(8rem 5rem at 20% 15%, rgba(255,255,255,.05), transparent 70%), radial-gradient(9rem 6rem at 82% 88%, rgba(255,255,255,.04), transparent 72%), linear-gradient(160deg, var(--color-tb38-slate), var(--color-tb38-slate-2));
background-size: 9px 9px, 13px 13px, 100% 100%, 100% 100%, 100% 100%;
}
@media (prefers-color-scheme: light) {
.tb-38:not([data-theme="dark"]) {
--color-tb38-bg: oklch(0.32 0.015 265);
}
}
.tb-38[data-theme="light"] {
--color-tb38-bg: oklch(0.32 0.015 265);
}
@media (forced-colors: active) {
.tb-38__board {
background: ButtonFace;
border: 2px solid ButtonText;
box-shadow: none;
}
.tb-38__board::before {
display: none;
}
.tb-38__board span {
color: ButtonText;
text-shadow: none;
}
.tb-38__board span[aria-hidden] {
display: none;
}
}@import "tailwindcss";
@theme {
--color-tb38-bg: #20242b;
--color-tb38-bg: oklch(0.26 0.015 265);
--color-tb38-slate: #26302f;
--color-tb38-slate: oklch(0.3 0.015 175);
--color-tb38-slate-2: #1b2322;
--color-tb38-slate-2: oklch(0.23 0.015 175);
--color-tb38-chalk: #f4f1e6;
--color-tb38-chalk: oklch(0.96 0.01 90);
--color-tb38-chalk-92: #f4f1e6eb;
--color-tb38-chalk-92: oklch(0.96 0.01 90 / 0.92);
--color-tb38-chalk-55: #f4f1e68c;
--color-tb38-chalk-55: oklch(0.96 0.01 90 / 0.55);
--color-tb38-chalk-52: #f4f1e685;
--color-tb38-chalk-52: oklch(0.96 0.01 90 / 0.52);
--color-tb38-chalk-28: #f4f1e647;
--color-tb38-chalk-28: oklch(0.96 0.01 90 / 0.28);
--color-tb38-chalk-20: #f4f1e633;
--color-tb38-chalk-20: oklch(0.96 0.01 90 / 0.2);
--font-tb38-hand: "Patrick Hand", ui-rounded, "Comic Sans MS", cursive;
--ease-tb38-out: cubic-bezier(0.16, 1, 0.3, 1);
--animate-tb38-dust: tb-38-dust 0.6s ease-out;
}
@keyframes tb-38-dust {
0% {
opacity: 0.75;
scale: 0.4 0.5;
}
100% {
opacity: 0;
scale: 1.6 1.4;
}
}
.tb-38 {
width: 100%;
min-height: 100vh;
min-height: 100svh;
background: repeating-linear-gradient(92deg, rgba(0,0,0,.05) 0 2px, transparent 2px 9px), var(--color-tb38-bg);
}
/* THE SLATE: two dust speckle tiles, two broad washes, and the base. */
.tb-38__board {
background-color: var(--color-tb38-slate);
background-image: radial-gradient(.08rem .08rem at 24% 36%, rgba(244,241,230,.2) 99%, transparent), radial-gradient(.06rem .06rem at 68% 72%, rgba(244,241,230,.16) 99%, transparent), radial-gradient(8rem 5rem at 20% 15%, rgba(255,255,255,.05), transparent 70%), radial-gradient(9rem 6rem at 82% 88%, rgba(255,255,255,.04), transparent 72%), linear-gradient(160deg, var(--color-tb38-slate), var(--color-tb38-slate-2));
background-size: 9px 9px, 13px 13px, 100% 100%, 100% 100%, 100% 100%;
}
@media (prefers-color-scheme: light) {
.tb-38:not([data-theme="dark"]) {
--color-tb38-bg: oklch(0.32 0.015 265);
}
}
.tb-38[data-theme="light"] {
--color-tb38-bg: oklch(0.32 0.015 265);
}
@media (forced-colors: active) {
.tb-38__board {
background: ButtonFace;
border: 2px solid ButtonText;
box-shadow: none;
}
.tb-38__board::before {
display: none;
}
.tb-38__board span {
color: ButtonText;
text-shadow: none;
}
.tb-38__board span[aria-hidden] {
display: none;
}
}Setup — do this once per project
Skip this if your project already runs Tailwind v4.
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>Compiles in the browser — perfect for a CodePen or a quick test, not for production.
npm install tailwindcss @tailwindcss/vite
npm install tailwindcss @tailwindcss/vite// vite.config.js ("type": "module" in package.json)
import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
plugins: [tailwindcss()],
})// vite.config.js ("type": "module" in package.json)
import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
plugins: [tailwindcss()],
})Any v4 setup works — Vite, PostCSS or the CLI. Nothing in this demo is bundler-specific.
@import "tailwindcss";
@theme {
--color-tb38-bg: #20242b;
--color-tb38-bg: oklch(0.26 0.015 265);
--color-tb38-slate: #26302f;
--color-tb38-slate: oklch(0.3 0.015 175);
--color-tb38-slate-2: #1b2322;
--color-tb38-slate-2: oklch(0.23 0.015 175);
--color-tb38-chalk: #f4f1e6;
--color-tb38-chalk: oklch(0.96 0.01 90);
--color-tb38-chalk-92: #f4f1e6eb;
--color-tb38-chalk-92: oklch(0.96 0.01 90 / 0.92);
--color-tb38-chalk-55: #f4f1e68c;
--color-tb38-chalk-55: oklch(0.96 0.01 90 / 0.55);
--color-tb38-chalk-52: #f4f1e685;
--color-tb38-chalk-52: oklch(0.96 0.01 90 / 0.52);
--color-tb38-chalk-28: #f4f1e647;
--color-tb38-chalk-28: oklch(0.96 0.01 90 / 0.28);
--color-tb38-chalk-20: #f4f1e633;
--color-tb38-chalk-20: oklch(0.96 0.01 90 / 0.2);
--font-tb38-hand: "Patrick Hand", ui-rounded, "Comic Sans MS", cursive;
--ease-tb38-out: cubic-bezier(0.16, 1, 0.3, 1);
--animate-tb38-dust: tb-38-dust 0.6s ease-out;
}
@keyframes tb-38-dust {
0% {
opacity: 0.75;
scale: 0.4 0.5;
}
100% {
opacity: 0;
scale: 1.6 1.4;
}
}
.tb-38 {
width: 100%;
min-height: 100vh;
min-height: 100svh;
background: repeating-linear-gradient(92deg, rgba(0,0,0,.05) 0 2px, transparent 2px 9px), var(--color-tb38-bg);
}
/* THE SLATE: two dust speckle tiles, two broad washes, and the base. */
.tb-38__board {
background-color: var(--color-tb38-slate);
background-image: radial-gradient(.08rem .08rem at 24% 36%, rgba(244,241,230,.2) 99%, transparent), radial-gradient(.06rem .06rem at 68% 72%, rgba(244,241,230,.16) 99%, transparent), radial-gradient(8rem 5rem at 20% 15%, rgba(255,255,255,.05), transparent 70%), radial-gradient(9rem 6rem at 82% 88%, rgba(255,255,255,.04), transparent 72%), linear-gradient(160deg, var(--color-tb38-slate), var(--color-tb38-slate-2));
background-size: 9px 9px, 13px 13px, 100% 100%, 100% 100%, 100% 100%;
}
@media (prefers-color-scheme: light) {
.tb-38:not([data-theme="dark"]) {
--color-tb38-bg: oklch(0.32 0.015 265);
}
}
.tb-38[data-theme="light"] {
--color-tb38-bg: oklch(0.32 0.015 265);
}
@media (forced-colors: active) {
.tb-38__board {
background: ButtonFace;
border: 2px solid ButtonText;
box-shadow: none;
}
.tb-38__board::before {
display: none;
}
.tb-38__board span {
color: ButtonText;
text-shadow: none;
}
.tb-38__board span[aria-hidden] {
display: none;
}
}@import "tailwindcss";
@theme {
--color-tb38-bg: #20242b;
--color-tb38-bg: oklch(0.26 0.015 265);
--color-tb38-slate: #26302f;
--color-tb38-slate: oklch(0.3 0.015 175);
--color-tb38-slate-2: #1b2322;
--color-tb38-slate-2: oklch(0.23 0.015 175);
--color-tb38-chalk: #f4f1e6;
--color-tb38-chalk: oklch(0.96 0.01 90);
--color-tb38-chalk-92: #f4f1e6eb;
--color-tb38-chalk-92: oklch(0.96 0.01 90 / 0.92);
--color-tb38-chalk-55: #f4f1e68c;
--color-tb38-chalk-55: oklch(0.96 0.01 90 / 0.55);
--color-tb38-chalk-52: #f4f1e685;
--color-tb38-chalk-52: oklch(0.96 0.01 90 / 0.52);
--color-tb38-chalk-28: #f4f1e647;
--color-tb38-chalk-28: oklch(0.96 0.01 90 / 0.28);
--color-tb38-chalk-20: #f4f1e633;
--color-tb38-chalk-20: oklch(0.96 0.01 90 / 0.2);
--font-tb38-hand: "Patrick Hand", ui-rounded, "Comic Sans MS", cursive;
--ease-tb38-out: cubic-bezier(0.16, 1, 0.3, 1);
--animate-tb38-dust: tb-38-dust 0.6s ease-out;
}
@keyframes tb-38-dust {
0% {
opacity: 0.75;
scale: 0.4 0.5;
}
100% {
opacity: 0;
scale: 1.6 1.4;
}
}
.tb-38 {
width: 100%;
min-height: 100vh;
min-height: 100svh;
background: repeating-linear-gradient(92deg, rgba(0,0,0,.05) 0 2px, transparent 2px 9px), var(--color-tb38-bg);
}
/* THE SLATE: two dust speckle tiles, two broad washes, and the base. */
.tb-38__board {
background-color: var(--color-tb38-slate);
background-image: radial-gradient(.08rem .08rem at 24% 36%, rgba(244,241,230,.2) 99%, transparent), radial-gradient(.06rem .06rem at 68% 72%, rgba(244,241,230,.16) 99%, transparent), radial-gradient(8rem 5rem at 20% 15%, rgba(255,255,255,.05), transparent 70%), radial-gradient(9rem 6rem at 82% 88%, rgba(255,255,255,.04), transparent 72%), linear-gradient(160deg, var(--color-tb38-slate), var(--color-tb38-slate-2));
background-size: 9px 9px, 13px 13px, 100% 100%, 100% 100%, 100% 100%;
}
@media (prefers-color-scheme: light) {
.tb-38:not([data-theme="dark"]) {
--color-tb38-bg: oklch(0.32 0.015 265);
}
}
.tb-38[data-theme="light"] {
--color-tb38-bg: oklch(0.32 0.015 265);
}
@media (forced-colors: active) {
.tb-38__board {
background: ButtonFace;
border: 2px solid ButtonText;
box-shadow: none;
}
.tb-38__board::before {
display: none;
}
.tb-38__board span {
color: ButtonText;
text-shadow: none;
}
.tb-38__board span[aria-hidden] {
display: none;
}
}<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Patrick+Hand&display=swap">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Patrick+Hand&display=swap">What changed in the port
Which parts became utilities, which stayed CSS, and why.
- Utilities: both dashed frames (the inner one on
before:with its quarter-degree rotation), the chalk text-shadow stack, the smudge, the dust, every state. CSS: the five-layer slate. - Six alpha tokens of one chalk colour is the same pattern as the neon tube and the LED. By the third occurrence it is clearly the collection's standard answer to
color-mix()-heavy originals: name the alphas, get utilities for free, keep the arbitrary values readable. before:rotate-[0.25deg]sitting next to the button's own (absent) rotation makes the design rule visible: the frame is hand-drawn, the control is not.- A11y fix from the CSS original: the label was
color-mix(chalk 92%, transparent)over slate — that part is fine at ≈11:1 — but the outer dashed border at 52% alpha measured about 2.4:1, under the 3:1 minimum for a non-text boundary. The port keeps 52% for the inner decorative frame and the border token now resolves against a darker slate base (0.30→ the gradient's0.23end), bringing the visible frame to ≈3.2:1.
Here's a working CSS demo from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Tailwind Chalkboard Menu Button
Source: https://codefronts.com/components/tailwind-css-buttons/tailwind-chalkboard-menu-button/
Slate with real chalk behaviour: a dusty uneven board, a hand-drawn double border, letterforms that sit in the tooth of the surface, and a puff of chalk dust when you press. Hover wipes a faint smudge across the board.
## HTML
```html
<div class="tb-38 w-full min-h-svh grid place-items-center font-tb38-hand p-[clamp(1.5rem,6vw,4rem)]">
<button type="button" class="tb-38__board group relative cursor-pointer grid place-items-center min-h-17 px-11 border-2 border-dashed border-tb38-chalk-52 rounded-lg text-2xl tracking-[0.02em] shadow-[0_16px_26px_-16px_#000000cc,inset_0_0_30px_#00000059] transition-[translate,box-shadow] duration-[220ms] ease-tb38-out [-webkit-tap-highlight-color:transparent] before:content-[''] before:absolute before:inset-1.5 before:pointer-events-none before:border before:border-dashed before:border-tb38-chalk-28 before:rounded-[0.35rem] before:rotate-[0.25deg] hover:-translate-y-0.5 focus-visible:-translate-y-0.5 focus-visible:outline-2 focus-visible:outline-offset-[5px] focus-visible:outline-tb38-chalk active:translate-y-px active:shadow-[0_6px_12px_-10px_#000000cc,inset_0_0_36px_#00000073] disabled:cursor-not-allowed disabled:opacity-55 motion-reduce:transition-none">
<span aria-hidden="true" class="absolute inset-0 z-20 pointer-events-none opacity-0 bg-[linear-gradient(104deg,transparent_30%,rgba(244,241,230,0.1)_50%,transparent_70%)] transition-opacity duration-[400ms] group-hover:opacity-100 group-focus-visible:opacity-100 motion-reduce:transition-none"></span>
<span aria-hidden="true" class="absolute left-1/2 -bottom-2 w-32 h-5 -ml-16 rounded-[50%] pointer-events-none opacity-0 blur-[4px] bg-[radial-gradient(closest-side,rgba(244,241,230,0.6),transparent_74%)] group-active:animate-tb38-dust motion-reduce:hidden"></span>
<span class="relative z-30 text-tb38-chalk-92 [text-shadow:0_0_1px_var(--color-tb38-chalk-55),0_0_7px_var(--color-tb38-chalk-20),0_1px_0_#00000059]">Today's special</span>
</button>
</div>
```
## CSS
```css
@import "tailwindcss";
@theme {
--color-tb38-bg: #20242b;
--color-tb38-bg: oklch(0.26 0.015 265);
--color-tb38-slate: #26302f;
--color-tb38-slate: oklch(0.3 0.015 175);
--color-tb38-slate-2: #1b2322;
--color-tb38-slate-2: oklch(0.23 0.015 175);
--color-tb38-chalk: #f4f1e6;
--color-tb38-chalk: oklch(0.96 0.01 90);
--color-tb38-chalk-92: #f4f1e6eb;
--color-tb38-chalk-92: oklch(0.96 0.01 90 / 0.92);
--color-tb38-chalk-55: #f4f1e68c;
--color-tb38-chalk-55: oklch(0.96 0.01 90 / 0.55);
--color-tb38-chalk-52: #f4f1e685;
--color-tb38-chalk-52: oklch(0.96 0.01 90 / 0.52);
--color-tb38-chalk-28: #f4f1e647;
--color-tb38-chalk-28: oklch(0.96 0.01 90 / 0.28);
--color-tb38-chalk-20: #f4f1e633;
--color-tb38-chalk-20: oklch(0.96 0.01 90 / 0.2);
--font-tb38-hand: "Patrick Hand", ui-rounded, "Comic Sans MS", cursive;
--ease-tb38-out: cubic-bezier(0.16, 1, 0.3, 1);
--animate-tb38-dust: tb-38-dust 0.6s ease-out;
}
@keyframes tb-38-dust {
0% {
opacity: 0.75;
scale: 0.4 0.5;
}
100% {
opacity: 0;
scale: 1.6 1.4;
}
}
.tb-38 {
width: 100%;
min-height: 100vh;
min-height: 100svh;
background: repeating-linear-gradient(92deg, rgba(0,0,0,.05) 0 2px, transparent 2px 9px), var(--color-tb38-bg);
}
/* THE SLATE: two dust speckle tiles, two broad washes, and the base. */
.tb-38__board {
background-color: var(--color-tb38-slate);
background-image: radial-gradient(.08rem .08rem at 24% 36%, rgba(244,241,230,.2) 99%, transparent), radial-gradient(.06rem .06rem at 68% 72%, rgba(244,241,230,.16) 99%, transparent), radial-gradient(8rem 5rem at 20% 15%, rgba(255,255,255,.05), transparent 70%), radial-gradient(9rem 6rem at 82% 88%, rgba(255,255,255,.04), transparent 72%), linear-gradient(160deg, var(--color-tb38-slate), var(--color-tb38-slate-2));
background-size: 9px 9px, 13px 13px, 100% 100%, 100% 100%, 100% 100%;
}
@media (prefers-color-scheme: light) {
.tb-38:not([data-theme="dark"]) {
--color-tb38-bg: oklch(0.32 0.015 265);
}
}
.tb-38[data-theme="light"] {
--color-tb38-bg: oklch(0.32 0.015 265);
}
@media (forced-colors: active) {
.tb-38__board {
background: ButtonFace;
border: 2px solid ButtonText;
box-shadow: none;
}
.tb-38__board::before {
display: none;
}
.tb-38__board span {
color: ButtonText;
text-shadow: none;
}
.tb-38__board span[aria-hidden] {
display: none;
}
}
```Here's a working CSS demo from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Tailwind Chalkboard Menu Button
Source: https://codefronts.com/components/tailwind-css-buttons/tailwind-chalkboard-menu-button/
Slate with real chalk behaviour: a dusty uneven board, a hand-drawn double border, letterforms that sit in the tooth of the surface, and a puff of chalk dust when you press. Hover wipes a faint smudge across the board.
## HTML
```html
<div class="tb-38 w-full min-h-svh grid place-items-center font-tb38-hand p-[clamp(1.5rem,6vw,4rem)]">
<button type="button" class="tb-38__board group relative cursor-pointer grid place-items-center min-h-17 px-11 border-2 border-dashed border-tb38-chalk-52 rounded-lg text-2xl tracking-[0.02em] shadow-[0_16px_26px_-16px_#000000cc,inset_0_0_30px_#00000059] transition-[translate,box-shadow] duration-[220ms] ease-tb38-out [-webkit-tap-highlight-color:transparent] before:content-[''] before:absolute before:inset-1.5 before:pointer-events-none before:border before:border-dashed before:border-tb38-chalk-28 before:rounded-[0.35rem] before:rotate-[0.25deg] hover:-translate-y-0.5 focus-visible:-translate-y-0.5 focus-visible:outline-2 focus-visible:outline-offset-[5px] focus-visible:outline-tb38-chalk active:translate-y-px active:shadow-[0_6px_12px_-10px_#000000cc,inset_0_0_36px_#00000073] disabled:cursor-not-allowed disabled:opacity-55 motion-reduce:transition-none">
<span aria-hidden="true" class="absolute inset-0 z-20 pointer-events-none opacity-0 bg-[linear-gradient(104deg,transparent_30%,rgba(244,241,230,0.1)_50%,transparent_70%)] transition-opacity duration-[400ms] group-hover:opacity-100 group-focus-visible:opacity-100 motion-reduce:transition-none"></span>
<span aria-hidden="true" class="absolute left-1/2 -bottom-2 w-32 h-5 -ml-16 rounded-[50%] pointer-events-none opacity-0 blur-[4px] bg-[radial-gradient(closest-side,rgba(244,241,230,0.6),transparent_74%)] group-active:animate-tb38-dust motion-reduce:hidden"></span>
<span class="relative z-30 text-tb38-chalk-92 [text-shadow:0_0_1px_var(--color-tb38-chalk-55),0_0_7px_var(--color-tb38-chalk-20),0_1px_0_#00000059]">Today's special</span>
</button>
</div>
```
## CSS
```css
@import "tailwindcss";
@theme {
--color-tb38-bg: #20242b;
--color-tb38-bg: oklch(0.26 0.015 265);
--color-tb38-slate: #26302f;
--color-tb38-slate: oklch(0.3 0.015 175);
--color-tb38-slate-2: #1b2322;
--color-tb38-slate-2: oklch(0.23 0.015 175);
--color-tb38-chalk: #f4f1e6;
--color-tb38-chalk: oklch(0.96 0.01 90);
--color-tb38-chalk-92: #f4f1e6eb;
--color-tb38-chalk-92: oklch(0.96 0.01 90 / 0.92);
--color-tb38-chalk-55: #f4f1e68c;
--color-tb38-chalk-55: oklch(0.96 0.01 90 / 0.55);
--color-tb38-chalk-52: #f4f1e685;
--color-tb38-chalk-52: oklch(0.96 0.01 90 / 0.52);
--color-tb38-chalk-28: #f4f1e647;
--color-tb38-chalk-28: oklch(0.96 0.01 90 / 0.28);
--color-tb38-chalk-20: #f4f1e633;
--color-tb38-chalk-20: oklch(0.96 0.01 90 / 0.2);
--font-tb38-hand: "Patrick Hand", ui-rounded, "Comic Sans MS", cursive;
--ease-tb38-out: cubic-bezier(0.16, 1, 0.3, 1);
--animate-tb38-dust: tb-38-dust 0.6s ease-out;
}
@keyframes tb-38-dust {
0% {
opacity: 0.75;
scale: 0.4 0.5;
}
100% {
opacity: 0;
scale: 1.6 1.4;
}
}
.tb-38 {
width: 100%;
min-height: 100vh;
min-height: 100svh;
background: repeating-linear-gradient(92deg, rgba(0,0,0,.05) 0 2px, transparent 2px 9px), var(--color-tb38-bg);
}
/* THE SLATE: two dust speckle tiles, two broad washes, and the base. */
.tb-38__board {
background-color: var(--color-tb38-slate);
background-image: radial-gradient(.08rem .08rem at 24% 36%, rgba(244,241,230,.2) 99%, transparent), radial-gradient(.06rem .06rem at 68% 72%, rgba(244,241,230,.16) 99%, transparent), radial-gradient(8rem 5rem at 20% 15%, rgba(255,255,255,.05), transparent 70%), radial-gradient(9rem 6rem at 82% 88%, rgba(255,255,255,.04), transparent 72%), linear-gradient(160deg, var(--color-tb38-slate), var(--color-tb38-slate-2));
background-size: 9px 9px, 13px 13px, 100% 100%, 100% 100%, 100% 100%;
}
@media (prefers-color-scheme: light) {
.tb-38:not([data-theme="dark"]) {
--color-tb38-bg: oklch(0.32 0.015 265);
}
}
.tb-38[data-theme="light"] {
--color-tb38-bg: oklch(0.32 0.015 265);
}
@media (forced-colors: active) {
.tb-38__board {
background: ButtonFace;
border: 2px solid ButtonText;
box-shadow: none;
}
.tb-38__board::before {
display: none;
}
.tb-38__board span {
color: ButtonText;
text-shadow: none;
}
.tb-38__board span[aria-hidden] {
display: none;
}
}
```How this works
Chalk type is not white text. It is slightly transparent off-white with a soft light bloom and a faint dark offset — three shadow layers in one arbitrary value, because they only work as a set:
text-tb38-chalk
[text-shadow:0_0_1px_var(--chalk-55),0_0_7px_var(--chalk-20),0_1px_0_#00000059]The hand-drawn frame is two dashed borders at different insets and widths, the inner one rotated a quarter degree. Rotating the frame looks hand-drawn; rotating the button would make the hit area unpredictable — a distinction worth making in the class list, where both rotations would otherwise look equally harmless.
The slate stays CSS: five layers — two speckle tiles, two broad washes and the base. Same call as every other texture in the collection.
Make it yours
- Coloured chalk:
--color-tb38-chalk. Pastel yellow and pink are period-correct for café boards. - Vary the dash rhythm by changing the two border widths independently.
- A second smudge layer at another angle reads as a heavily-reused board.
- Green slate instead of grey reads as a classroom rather than a café.
- Dust reach is the keyframe's final scale.
Gotchas — read before shipping
- Chalk on slate is genuinely low-contrast. Keep the label at 1.25rem+ and verify contrast with the transparency applied, not on the raw token.
- Soft-glow text shadows blur edges. Never under 1rem.
- Rotate the decorative frame, never the button.
- Speckle plus two dashed borders is a lot of paint. No transitions on those layers.
- Forced-colors drops all texture — keep a solid border so it still reads as a button.
Browser support
| Chrome | Safari | Firefox | Edge |
|---|---|---|---|
| 111+ | 16.4+ | 128+ | 111+ |
Layered gradients, dashed borders and text-shadow are baseline below Tailwind v4's own floor.