Tansy UI: a themeable React component kit

Tansy UI is a React component kit by OpenKhalix, named after the tansy
flower ("golden buttons"). It has two surfaces:

- A landing page built entirely from the kit's own components, with
  five featured parts, a palette-switching playground form, and links
  into Storybook
- A Storybook workshop with Tansy branding, a Welcome page, palette
  toolbar and accessibility checks

Includes 15 components with colocated tokens and stories, seven brand
palettes, a palette-aware logo, a Docker/nginx image, a scripted
cPanel deploy, and a generator that keeps the landing page catalogue
in sync with Storybook.
This commit is contained in:
thekhalidsha committed 2026-09-28 17:09:57 +05:30
commit 9d406d6d2a
81 files changed
+14240

No files matched your search

+696
View File
@@ -0,0 +1,696 @@
@import "tailwindcss";
@theme {
--font-sans: "Instrument Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
--font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
--font-display: "Schibsted Grotesk", "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
--shadow-doc: 0 18px 46px -34px rgba(23, 25, 29, 0.38);
/* ------------------------------------------------------------------
Palette token registration.
Tailwind v4 only *generates* a utility class if its colour token is
declared here. The ported components reference `bg-primary-500`,
`text-primary-600`, `border-zink-700` and so on; without these
declarations the build silently emits no rules and those elements
render with no colour at all.
The values below are the Classic Blue defaults. They exist so the
utility classes are generated at build time. The Storybook palette
switcher overrides them at runtime on a wrapper element (see
src/theme/applyPalette.ts), which re-themes without a rebuild.
------------------------------------------------------------------ */
--color-primary-50: #eff6ff;
--color-primary-100: #dbeafe;
--color-primary-200: #bfdbfe;
--color-primary-300: #93c5fd;
--color-primary-400: #60a5fa;
--color-primary-500: #305ddd;
--color-primary-600: #274bc4;
--color-primary-700: #1e3a8a;
--color-primary-800: #1e40af;
--color-primary-900: #1e3a8a;
--color-primary: #305ddd;
--color-secondary-50: #f5f3ff;
--color-secondary-100: #ede9fe;
--color-secondary-200: #ddd6fe;
--color-secondary-300: #c4b5fd;
--color-secondary-400: #a78bfa;
--color-secondary-500: #8b5cf6;
--color-secondary-600: #7c3aed;
--color-secondary-700: #6d28d9;
--color-secondary-800: #5b21b6;
--color-secondary-900: #4c1d95;
--color-secondary: #8b5cf6;
--color-zink-50: #f8f8f9;
--color-zink-100: #f1f2f3;
--color-zink-200: #e4e6e8;
--color-zink-300: #cfd3d6;
--color-zink-400: #9aa2a9;
--color-zink-500: #6b7680;
--color-zink-600: #4d5761;
--color-zink-700: #313a43;
--color-zink-800: #1f262c;
--color-zink-900: #12171b;
--color-zink: #6b7680;
/* Semantic colours used by Alert, Badge and the status components. */
--color-success: #10b981;
--color-warning: #f59e0b;
--color-error: #ef4444;
--color-info: #3b82f6;
--color-danger: #ef4444;
}
/* ------------------------------------------------------------------
Tansy UI landing page.
Page neutrals are cool greys biased toward the blue default. The
accent is never a literal: it reads the live palette ramp, so the
picker in the playground re-themes the page chrome with the parts.
------------------------------------------------------------------ */
:root {
--canvas: #f3f4f6;
--surface: #ffffff;
--surface-sunk: #eceef2;
--ink: #12151c;
--ink-soft: #4a5162;
--ink-muted: #6b7384;
--line: #dde1e8;
--line-strong: #c5cad4;
}
@layer base {
* {
box-sizing: border-box;
}
html {
background: var(--canvas);
scroll-behavior: smooth;
scroll-padding-top: 5rem;
}
body {
margin: 0;
min-height: 100vh;
background: var(--canvas);
color: var(--ink);
font-family: var(--font-sans);
font-size: 1rem;
line-height: 1.6;
font-synthesis: none;
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
}
button,
input,
select,
textarea {
font: inherit;
}
a {
color: inherit;
text-decoration: none;
-webkit-tap-highlight-color: transparent;
}
:focus-visible {
outline: 2px solid var(--color-primary-500);
outline-offset: 3px;
}
::selection {
color: #ffffff;
background: var(--color-primary-500);
}
}
/* Aliases are declared on the shell, where applyPalette writes the ramp, so
they resolve against the live palette instead of the :root defaults. */
.site-shell {
--accent: var(--color-primary-500);
--accent-strong: var(--color-primary-700);
--accent-soft: var(--color-primary-50);
--accent-line: var(--color-primary-200);
min-height: 100vh;
overflow-x: clip;
}
.container {
width: min(100%, 72rem);
margin-inline: auto;
padding-inline: 1.25rem;
}
.kicker,
.eyebrow {
margin: 0;
font-family: var(--font-mono);
font-size: 0.75rem;
font-weight: 500;
letter-spacing: 0.06em;
text-transform: uppercase;
color: var(--accent);
}
h1,
h2,
h3 {
margin: 0;
font-family: var(--font-display);
color: var(--ink);
text-wrap: balance;
}
code {
font-family: var(--font-mono);
font-size: 0.8125rem;
}
/* ---------- Header ---------- */
.site-header {
position: sticky;
top: 0;
z-index: 20;
border-bottom: 1px solid var(--line);
background: color-mix(in srgb, var(--canvas) 88%, transparent);
backdrop-filter: blur(10px);
}
.header-inner {
display: flex;
align-items: center;
gap: 2rem;
min-height: 4rem;
}
.brand {
display: inline-flex;
align-items: center;
gap: 0.55rem;
}
.brand-name {
font-family: var(--font-display);
font-size: 1.3rem;
font-weight: 800;
letter-spacing: -0.03em;
}
.brand-ui {
margin-left: 0.22em;
font-weight: 700;
color: var(--ink-muted);
}
.brand-by {
padding-left: 0.6rem;
border-left: 1px solid var(--line-strong);
font-size: 0.8125rem;
color: var(--ink-muted);
}
.header-nav {
display: flex;
gap: 1.5rem;
margin-left: auto;
font-size: 0.875rem;
font-weight: 500;
color: var(--ink-soft);
}
.header-nav a:hover {
color: var(--ink);
}
/* ---------- Hero ---------- */
.hero {
display: grid;
grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
align-items: center;
gap: 4rem;
padding-block: 4.5rem 5rem;
}
.hero-copy {
display: flex;
flex-direction: column;
gap: 1.5rem;
}
.eyebrow {
display: flex;
flex-wrap: wrap;
gap: 0.35rem 0.9rem;
}
.eyebrow-dim {
color: var(--ink-muted);
font-variant-numeric: tabular-nums;
}
.hero-copy h1 {
font-size: clamp(2.75rem, 6vw, 4.6rem);
font-weight: 800;
line-height: 0.98;
letter-spacing: -0.045em;
}
.hero-copy h1 em {
font-style: normal;
color: var(--accent);
}
.lede {
max-width: 34rem;
margin: 0;
font-size: 1.125rem;
color: var(--ink-soft);
}
.hero-actions {
display: flex;
flex-wrap: wrap;
gap: 0.75rem;
}
.stack {
margin: 0;
font-family: var(--font-mono);
font-size: 0.75rem;
color: var(--ink-muted);
}
/* The featured card is a Tansy Card; these classes tune its slots. */
.featured-header {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
padding: 1rem 1.25rem;
}
.featured-header h2 {
font-size: 1rem;
font-weight: 700;
letter-spacing: -0.01em;
}
.featured-body {
padding: 0;
}
.featured-list {
margin: 0;
padding: 0;
list-style: none;
}
.featured-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
min-height: 4.25rem;
padding: 0.75rem 1.25rem;
border-bottom: 1px solid var(--line);
}
.featured-row:last-child {
border-bottom: 0;
}
.featured-text {
display: flex;
flex-direction: column;
min-width: 0;
}
.featured-text a {
width: fit-content;
font-family: var(--font-display);
font-size: 1rem;
font-weight: 700;
color: var(--ink);
}
.featured-text a:hover {
color: var(--accent);
text-decoration: underline;
text-underline-offset: 3px;
}
.featured-text span {
font-size: 0.8125rem;
color: var(--ink-muted);
}
.featured-preview {
display: flex;
flex-shrink: 0;
align-items: center;
justify-content: flex-end;
}
.preview-badges {
display: inline-flex;
gap: 0.375rem;
}
.featured-footer {
padding: 1rem 1.25rem;
}
/* ---------- Playground ---------- */
.playground {
padding-block: 5rem;
border-block: 1px solid var(--line);
background: var(--surface-sunk);
}
.playground-grid {
display: grid;
grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
align-items: start;
gap: 4rem;
}
.playground-intro {
display: flex;
flex-direction: column;
gap: 1.25rem;
}
.playground-intro h2,
.principles-head h2 {
font-size: clamp(1.75rem, 3.2vw, 2.4rem);
font-weight: 800;
line-height: 1.08;
letter-spacing: -0.035em;
}
.playground-intro > p:not(.kicker) {
max-width: 30rem;
margin: 0;
color: var(--ink-soft);
}
.palette-picker {
margin: 0.5rem 0 0;
padding: 0;
border: 0;
}
.palette-picker legend {
margin-bottom: 0.6rem;
font-size: 0.8125rem;
font-weight: 600;
color: var(--ink);
}
.palette-options {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
}
.palette-options button {
display: inline-flex;
align-items: center;
gap: 0.45rem;
min-height: 2.25rem;
padding: 0 0.8rem 0 0.55rem;
border: 1px solid var(--line-strong);
border-radius: 999px;
background: var(--surface);
font-size: 0.8125rem;
font-weight: 500;
color: var(--ink-soft);
cursor: pointer;
transition: border-color 150ms, color 150ms;
}
.palette-options button:hover {
border-color: var(--ink-muted);
color: var(--ink);
}
.palette-options button[aria-pressed="true"] {
border-color: var(--accent);
box-shadow: 0 0 0 1px var(--accent);
color: var(--ink);
}
.swatch {
width: 0.85rem;
height: 0.85rem;
border-radius: 999px;
}
.palette-note {
min-height: 1.5em;
margin: 0.6rem 0 0;
font-size: 0.8125rem;
color: var(--ink-muted);
}
.ramp {
display: grid;
grid-template-columns: repeat(10, minmax(0, 1fr));
gap: 0.25rem;
}
.ramp-step {
display: flex;
flex-direction: column;
gap: 0.3rem;
}
.ramp-chip {
height: 2.5rem;
border-radius: 0.3rem;
box-shadow: inset 0 0 0 1px rgb(18 21 28 / 0.06);
transition: background-color 250ms;
}
.ramp-label {
font-family: var(--font-mono);
font-size: 0.6875rem;
text-align: center;
color: var(--ink-muted);
font-variant-numeric: tabular-nums;
}
.ramp-caption {
margin: -0.5rem 0 0;
font-size: 0.8125rem;
color: var(--ink-muted);
}
.ramp-caption code {
color: var(--ink);
}
/* The form is a Tansy Card; these classes lay out its slots. */
.employee-card-header {
display: flex;
flex-direction: column;
gap: 0.35rem;
padding: 1.25rem 1.5rem;
}
.employee-card-header p {
margin: 0;
font-size: 0.875rem;
font-weight: 400;
color: var(--ink-muted);
}
.employee-card-body {
display: flex;
flex-direction: column;
gap: 1.35rem;
padding: 1.5rem;
}
.form-row {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 1rem;
}
.employee-card-footer {
display: flex;
justify-content: flex-end;
gap: 0.75rem;
padding: 1rem 1.5rem;
}
/* ---------- Principles ---------- */
.principles {
display: flex;
flex-direction: column;
gap: 2.5rem;
padding-block: 5rem;
}
.principles-head {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.principle-grid {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 2.5rem;
}
.principle {
display: flex;
flex-direction: column;
gap: 0.6rem;
padding-top: 1.25rem;
border-top: 2px solid var(--ink);
}
.principle h3 {
font-size: 1.125rem;
font-weight: 700;
letter-spacing: -0.015em;
}
.principle p {
margin: 0;
flex: 1;
color: var(--ink-soft);
}
.principle code {
width: fit-content;
padding: 0.2rem 0.5rem;
border-radius: 0.3rem;
background: var(--accent-soft);
color: var(--accent-strong);
}
/* ---------- Footer ---------- */
.site-footer {
border-top: 1px solid var(--line);
background: var(--surface);
}
.footer-inner {
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-between;
gap: 1rem;
padding-block: 1.75rem;
font-size: 0.875rem;
color: var(--ink-soft);
}
.footer-brand {
display: inline-flex;
align-items: center;
gap: 0.5rem;
}
.footer-brand strong {
font-family: var(--font-display);
color: var(--ink);
}
.footer-nav {
display: flex;
gap: 1.25rem;
}
.footer-nav a:hover {
color: var(--ink);
}
/* ---------- Responsive ---------- */
@media (max-width: 960px) {
.hero,
.playground-grid {
grid-template-columns: minmax(0, 1fr);
gap: 3rem;
}
.hero {
padding-block: 3rem 4rem;
}
.principle-grid {
grid-template-columns: minmax(0, 1fr);
gap: 2rem;
}
}
@media (max-width: 640px) {
.container {
padding-inline: 1rem;
}
.header-inner {
gap: 1rem;
}
.header-nav,
.brand-ui {
margin-left: 0.22em;
font-weight: 700;
color: var(--ink-muted);
}
.brand-by {
display: none;
}
.header-cta {
margin-left: auto;
}
.form-row {
grid-template-columns: minmax(0, 1fr);
}
.playground,
.principles {
padding-block: 3.5rem;
}
.employee-card-body,
.employee-card-header,
.employee-card-footer {
padding-inline: 1.1rem;
}
}
@media (prefers-reduced-motion: reduce) {
html {
scroll-behavior: auto;
}
*,
*::before,
*::after {
transition-duration: 0.01ms !important;
animation-duration: 0.01ms !important;
}
}