Show how to install Tansy UI on the landing page and docs
CI / check (push) Successful in 1m13s

The landing page had no install command anywhere, and the Storybook
welcome page only linked onward to Getting started. Add an Install
section to the site with the npm, pnpm, yarn and bun commands, the two
styling setups, and a link to the package on npmjs.com. Repeat the npm
command on the Storybook welcome page.

Also correct the roadmap, which still listed publishing the first
release and adding a public repository URL as pending. Both shipped in
0.4.0 and 0.4.1.
This commit is contained in:
thekhalidsha committed 2026-09-29 11:38:46 +05:30
1 parent 63fc279123
commit 260bb7c1ca
4 files changed
+233 -5

No files matched your search

+7 -1
View File
@@ -1,4 +1,4 @@
import { Meta } from '@storybook/addon-docs/blocks' import { Meta, Source } from '@storybook/addon-docs/blocks'
import { DocHero, DocCards } from './DocBlocks' import { DocHero, DocCards } from './DocBlocks'
import { documentation, totalStories } from '@tansy/brand' import { documentation, totalStories } from '@tansy/brand'
@@ -11,6 +11,12 @@ import { documentation, totalStories } from '@tansy/brand'
Tansy UI is named after the tansy flower, also called golden buttons: many small round heads that read as one bloom. The kit works the same way. It currently has **{documentation.length} components** and **{totalStories} stories**, built on Base UI with React 19, TypeScript and Tailwind CSS v4. Tansy UI is named after the tansy flower, also called golden buttons: many small round heads that read as one bloom. The kit works the same way. It currently has **{documentation.length} components** and **{totalStories} stories**, built on Base UI with React 19, TypeScript and Tailwind CSS v4.
## Install
<Source language="bash" code={`npm install @openkhalix/tansy-ui`} />
Then add one line of CSS, either `@import "@openkhalix/tansy-ui/tokens.css"` for Tailwind v4 apps, or `import '@openkhalix/tansy-ui/styles.css'` for apps without Tailwind. Both setups are covered in [Getting started](/docs/introduction-getting-started--documentation).
## Start here ## Start here
<DocCards <DocCards
+105 -1
View File
@@ -22,6 +22,24 @@ import { TansyMark, documentation, featured, totalStories, type FeaturedName } f
const STORYBOOK = '/docs/' const STORYBOOK = '/docs/'
const NPM_PAGE = 'https://www.npmjs.com/package/@openkhalix/tansy-ui'
const PKG = '@openkhalix/tansy-ui'
/** The install command per package manager, most-used first. */
const INSTALL_COMMANDS = [
{ manager: 'npm', command: `npm install ${PKG}` },
{ manager: 'pnpm', command: `pnpm add ${PKG}` },
{ manager: 'yarn', command: `yarn add ${PKG}` },
{ manager: 'bun', command: `bun add ${PKG}` },
] as const
/** The two supported styling setups: with Tailwind v4, and without. */
const TAILWIND_SETUP = `@import "tailwindcss";
@import "${PKG}/tokens.css";
@source "../node_modules/${PKG}/dist";`
const PLAIN_SETUP = `import '${PKG}/styles.css'`
const RAMP_STEPS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900] as const const RAMP_STEPS = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900] as const
const DEPARTMENTS = [ const DEPARTMENTS = [
@@ -79,7 +97,7 @@ const roadmap = [
stage: 'Planned', stage: 'Planned',
title: 'v1', title: 'v1',
color: 'neutral', color: 'neutral',
items: ['Publish to npm', 'A shadcn-compatible registry', 'Palette builder with contrast checks'], items: ['A shadcn-compatible registry', 'Palette builder with contrast checks'],
}, },
] as const ] as const
@@ -119,6 +137,17 @@ function highlight(code: string) {
}) })
} }
/** Colours the bare package name in a shell command, e.g. `npm install @openkhalix/tansy-ui`. */
function highlightCommand(code: string) {
const escaped = PKG.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&')
return code
.split(new RegExp(`^(\\S+ (?:install|add) )(${escaped})$`))
.map((part, index) => {
if (index === 0) return part
return <span className={index === 1 ? 'tok-key' : 'tok-pkg'} key={index}>{part}</span>
})
}
function CodeSample() { function CodeSample() {
const [copied, setCopied] = useState(false) const [copied, setCopied] = useState(false)
@@ -147,6 +176,35 @@ function CodeSample() {
) )
} }
/** A dark code panel with a copy button, reused by every install command. */
function CommandPanel({ label, code }: { label: string; code: string }) {
const [copied, setCopied] = useState(false)
async function copy() {
try {
await navigator.clipboard.writeText(code)
setCopied(true)
window.setTimeout(() => setCopied(false), 1600)
} catch {
setCopied(false)
}
}
return (
<div className="code-sample command-panel">
<div className="code-sample-bar">
<span>{label}</span>
<Button size="sm" variant="ghost" onClick={copy} className="code-copy" aria-label={`Copy the ${label} command`}>
{copied ? 'Copied' : 'Copy'}
</Button>
</div>
<pre>
<code>{highlightCommand(code)}</code>
</pre>
</div>
)
}
type FormErrors = Partial<Record<'name' | 'email' | 'department' | 'confirmed', string>> type FormErrors = Partial<Record<'name' | 'email' | 'department' | 'confirmed', string>>
function EmployeeForm() { function EmployeeForm() {
@@ -302,6 +360,7 @@ function App() {
v{VERSION} v{VERSION}
</a> </a>
<nav className="header-nav" aria-label="Primary"> <nav className="header-nav" aria-label="Primary">
<a href="#install">Install</a>
<a href={DOCS.gettingStarted}>Docs</a> <a href={DOCS.gettingStarted}>Docs</a>
<a href={STORYBOOK}>Components</a> <a href={STORYBOOK}>Components</a>
<a href="#playground">Theming</a> <a href="#playground">Theming</a>
@@ -381,6 +440,51 @@ function App() {
</Card> </Card>
</section> </section>
<section className="container install" id="install" aria-labelledby="install-title">
<div className="section-head">
<p className="kicker">Install</p>
<h2 id="install-title">One command from the npm registry.</h2>
<p className="section-lede">
Tansy UI is published as <code className="inline-code">{PKG}</code> under the OpenKhalix organisation.
It ships type declarations and one module per component, so your bundle only carries what you import.
</p>
</div>
<div className="install-grid">
<div className="install-main">
<CommandPanel label="Install with npm" code={INSTALL_COMMANDS[0].command} />
<p className="install-meta">
v{VERSION} · MIT · React 19 peer dependency ·{' '}
<a href={NPM_PAGE} rel="noreferrer noopener" target="_blank">
view on npmjs.com
</a>
</p>
<ul className="install-alt" aria-label="Other package managers">
{INSTALL_COMMANDS.slice(1).map(({ manager, command }) => (
<li key={manager}>
<CommandPanel label={manager} code={command} />
</li>
))}
</ul>
</div>
<div className="install-setup">
<h3>Then add the styles</h3>
<p className="install-setup-note">
Pick one. With Tailwind v4, import the tokens and let Tailwind scan the package. Without Tailwind,
import the prebuilt stylesheet, which carries its own reset.
</p>
<div className="install-panels">
<CommandPanel label="With Tailwind CSS v4" code={TAILWIND_SETUP} />
<CommandPanel label="Without Tailwind" code={PLAIN_SETUP} />
</div>
<LinkButton href={DOCS.gettingStarted} variant="outline" endIcon={<ArrowRight aria-hidden="true" />}>
Full getting started
</LinkButton>
</div>
</div>
</section>
<section className="container why" aria-labelledby="why-title"> <section className="container why" aria-labelledby="why-title">
<div className="section-head"> <div className="section-head">
<p className="kicker">Why Tansy</p> <p className="kicker">Why Tansy</p>
+110 -1
View File
@@ -701,6 +701,114 @@
color: #82aaff; color: #82aaff;
} }
.tok-pkg {
color: #a5d6a7;
font-weight: 600;
}
/* ---------- Install ---------- */
.install {
display: flex;
flex-direction: column;
gap: 2.5rem;
padding-block: 1rem 5rem;
}
.section-lede {
max-width: 40rem;
color: var(--ink-soft);
font-size: 1.0625rem;
line-height: 1.6;
}
.inline-code {
padding: 0.1em 0.4em;
border-radius: 0.3rem;
background: var(--surface-sunk);
font-family: var(--font-mono);
font-size: 0.9em;
color: var(--ink);
overflow-wrap: anywhere;
}
.install-grid {
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
gap: 2.5rem;
align-items: start;
}
.install-main {
display: flex;
flex-direction: column;
gap: 0.85rem;
min-width: 0;
}
.command-panel {
min-height: 0;
}
.install-main > .command-panel pre {
font-size: 0.8125rem;
}
.install-meta {
font-family: var(--font-mono);
font-size: 0.75rem;
color: var(--ink-muted);
}
.install-meta a {
color: var(--accent);
text-decoration: underline;
text-underline-offset: 0.2em;
}
.install-meta a:hover {
color: var(--accent-strong);
}
.install-alt {
display: grid;
gap: 0.6rem;
margin: 0.25rem 0 0;
padding: 0;
list-style: none;
}
.install-setup {
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 0.85rem;
min-width: 0;
}
.install-setup h3 {
font-size: 1.25rem;
font-weight: 700;
letter-spacing: -0.02em;
}
.install-setup-note {
color: var(--ink-soft);
font-size: 0.9375rem;
line-height: 1.6;
}
.install-panels {
display: grid;
gap: 0.6rem;
width: 100%;
min-width: 0;
}
.install-panels pre {
font-size: 0.75rem;
}
/* ---------- Roadmap ---------- */ /* ---------- Roadmap ---------- */
.roadmap { .roadmap {
@@ -837,7 +945,8 @@
} }
.why-grid, .why-grid,
.roadmap-grid { .roadmap-grid,
.install-grid {
grid-template-columns: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr);
} }
+11 -2
View File
@@ -74,14 +74,23 @@ Done in v0.4.0:
Tailwind, plain React and Next.js apps (`npm run test:package`) Tailwind, plain React and Next.js apps (`npm run test:package`)
- [x] CI and tag-triggered publishing (Gitea Actions) - [x] CI and tag-triggered publishing (Gitea Actions)
Done in v0.4.1:
- [x] The `openkhalix` npm organisation, and the first published releases
(0.4.0 and 0.4.1 on the `latest` tag)
- [x] Public repository at `git.openkhalix.com/thekhalidsha/tansy-ui`, with
`repository` and `bugs` in `package.json` so the npm page links to the
source and its issue tracker
Still to do: Still to do:
- [ ] Create the `openkhalix` npm organisation and publish the first release.
- [ ] Serve the same components as a shadcn-compatible registry, so - [ ] Serve the same components as a shadcn-compatible registry, so
`npx shadcn add <url>` copies a Tansy component into a project. `npx shadcn add <url>` copies a Tansy component into a project.
- [ ] Ship the palettes as a registry base item (tokens, fonts and CSS - [ ] Ship the palettes as a registry base item (tokens, fonts and CSS
variables in one install). variables in one install).
- [ ] A public repository URL in `package.json` once the repo is public. - [ ] An npm automation token, so releasing is a tag push with no browser
step. Today `npm publish` needs web 2FA, which blocks unattended
releases.
## Phase 3: Where Tansy can lead ## Phase 3: Where Tansy can lead