Specification
- Catalogue
- No. 17 of 110
- Section
- Buttons and toggles
- Interaction
- Press
- Element
- Button, Card
- Preview
- Live component
- Imports
- No packages
- Added
Notes
Buttons and panels lit from above, that press down when clicked.
A highlight on the top edge, shade on the bottom and a tight contact shadow make a flat colour read as an object. Pressing flips the light.
Top-edge inset highlight, bottom inset shade. Pressed: 1px down, inner shadow.
Code
React and plain CSS"use client";
import type { LivePreviewProps } from "@/components/live/types";
import { PieceStage } from "@/components/pieces/stage/PieceStage";
import "@/components/pieces/kit/lit.css";
import "./lit-surfaces.css";
function LitSurfacesDemo() {
return (
<div className="dm">
<div className="dm-lit">
<button type="button" className="dm-lit-btn lit-button" data-fill="ink">
Get started
</button>
<div className="dm-lit-panel lit-panel on-dark">
<strong>Ready when you are</strong>
<p>A dark panel lit from above, with a white button that presses.</p>
<button type="button" className="dm-lit-btn lit-button" data-fill="white">
Book a call
</button>
</div>
</div>
</div>
);
}
export default function LitSurfacesEntry(props: LivePreviewProps) {
return (
<PieceStage {...props} label="Lit buttons and panels">
<LitSurfacesDemo />
</PieceStage>
);
}