Close button <button>
Close buttons are used to dismiss overlays such as dialogs, drawers, toasts, and popovers. They render a close icon without any visible label.
HTML tag
<button>⏣Native HTML
⬡Progressive
◇Custom
⬢Shadow DOM
Native HTML Element
Options
Appearance
Pick a visual style via data-appearance. Each appearance has its own CSS import.
Ring
html
<button
type="button"
class="l-close"
data-appearance="ring"
aria-label="Close"
></button>css
@import 'luxen-ui/css/close-button/ring';Square
html
<button
type="button"
class="l-close"
data-appearance="square"
aria-label="Close"
></button>css
@import 'luxen-ui/css/close-button/square';Circle
html
<button
type="button"
class="l-close"
data-appearance="circle"
aria-label="Close"
></button>css
@import 'luxen-ui/css/close-button/circle';Accessibility
Criteria
- Active state
Visual feedback on press
WCAG1.4.1- Disabled state
Appears inactive, not focusable when disabled
WCAG2.5.2- Role
Uses native
<button>— no extra ARIA role neededWCAG4.1.2
Keyboard interactions
API reference
Importing
css
@import 'luxen-ui/css/close-button/ring';Attributes & Properties
data-appearancering | square | circleAttribute- Visual appearance (matches the imported appearance CSS).
commandAttribute- Invoker command (typically
close). commandforAttribute- ID of the target element to close.
CSS classes
.l-closeClass- Base close button with X icon via CSS mask.
CSS custom properties
--sizedefault:36pxCustom property- Button size.
--icon-colorCustom property- Icon color.
--icon-sizedefault:24pxCustom property- Icon size.
--ring-colorCustom property- Hover ring color (
ringappearance only). --ring-ticknessCustom property- Hover ring thickness (
ringappearance only).