Files
clj-ui-framework/src/ui/button.css
Florian Schroedl e4ee7b750e feat(button): add link variant and polymorphic <a> rendering
When :href is provided, the button renders as <a> instead of <button>,
enabling navigation links with full button styling.

New :link variant renders as a minimal text link (underlined, accent
color, no background/padding) — works as both <button> and <a>.

CSS includes reset styles for a.btn (removes default link decoration)
and preserves underline for a.btn-link.
2026-03-03 17:04:41 +01:00

87 lines
1.5 KiB
CSS

.btn {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.5em;
padding: var(--size-2) var(--size-4);
font-size: var(--font-sm);
font-weight: 500;
line-height: var(--size-5);
border: none;
border-radius: var(--radius-md);
cursor: pointer;
font-family: inherit;
}
.btn-primary {
background: var(--accent);
color: var(--fg-on-accent);
}
.btn-primary:hover:not(:disabled) {
filter: brightness(1.1);
}
.btn-secondary {
background: var(--bg-1);
color: var(--fg-0);
border: var(--border-0);
}
.btn-secondary:hover:not(:disabled) {
background: var(--bg-2);
}
.btn-ghost {
background: transparent;
color: var(--fg-0);
}
.btn-ghost:hover:not(:disabled) {
background: var(--bg-1);
}
.btn-danger {
background: var(--danger);
color: var(--fg-on-danger);
}
.btn-danger:hover:not(:disabled) {
filter: brightness(1.1);
}
.btn-link {
background: transparent;
color: var(--accent);
text-decoration: underline;
text-underline-offset: var(--size-1);
padding: 0;
border: none;
}
.btn-link:hover:not(:disabled) {
filter: brightness(1.2);
}
/* Link buttons rendered as <a> need reset styles */
a.btn {
text-decoration: none;
color: inherit;
}
a.btn-link {
text-decoration: underline;
color: var(--accent);
}
.btn-sm {
padding: var(--size-1) var(--size-2);
font-size: var(--font-xs);
line-height: var(--size-4);
}
.btn-lg {
padding: var(--size-3) var(--size-6);
font-size: var(--font-base);
line-height: var(--size-6);
}
.btn:disabled {
opacity: 0.5;
cursor: not-allowed;
}