MacTrafficLights
MacTrafficLights renders the close, minimize, and zoom buttons used in macOS-style application chrome. Each button exposes an accessible label and an optional action callback.
import { MacTrafficLights, Toolbar } from "density-base-ui";
export default function MacTrafficLightsExample() {
return (
<Toolbar depth="4" padding={true} childrenStart={<MacTrafficLights />} />
);
}Variant
import { MacTrafficLights, Toolbar } from "density-base-ui";
export default function MacTrafficLightsVariantExample() {
return (
<>
<Toolbar
depth="4"
padding={true}
childrenStart={
<MacTrafficLights
aria-label="Color window controls"
variant="color"
/>
}
/>
<Toolbar
depth="4"
padding={true}
childrenStart={
<MacTrafficLights aria-label="Gray window controls" variant="gray" />
}
/>
</>
);
}| Prop | Values | Required | Default | Behavior | Description |
|---|---|---|---|---|---|
closeLabel | string | Not required | "Close" | — | — |
minimizeLabel | string | Not required | "Minimize" | — | — |
onClose | React.MouseEventHandler<HTMLButtonElement> | Not required | — | — | — |
onMinimize | React.MouseEventHandler<HTMLButtonElement> | Not required | — | — | — |
onZoom | React.MouseEventHandler<HTMLButtonElement> | Not required | — | — | — |
variant | color, gray | Not required | "color" | Attribute: data-dn-mac-traffic-lights-variant | — |
zoomLabel | string | Not required | "Zoom" | — | — |
This component also accepts props from native APIs. They are passed through and intentionally kept out of this focused Density API table.