# @k8slens/lds

> Lens Design System — React component library for the Lens product portfolio

Latest version **2.6.0** (published 2026-11-12) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @k8slens/lds
pnpm add @k8slens/lds
yarn add @k8slens/lds
bun add @k8slens/lds
```

## Health

**Score 70/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.6.0 |
| Published | 2026-11-12 |
| First published | 2022-11-14 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 6 |
| Unpacked size | 2.6 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | jakolehm, k8slens-bot, mirantis_it, skoncar, jansav, jweak-mirantis, oasiedl, yaltonmir, nawitus, iku-turso |

## Links

- npm: https://www.npmjs.com/package/@k8slens/lds
- Repository: https://github.com/lensapp/lds
- Homepage: https://k8slens.dev
- Issues: https://github.com/lensapp/lds/issues
- npm.io page: https://npm.io/package/@k8slens/lds

## Dependencies (6)

- [clsx](https://npm.io/package/clsx.md) ^2.1.0
- [remark-gfm](https://npm.io/package/remark-gfm.md) ^4.0.1
- [react-markdown](https://npm.io/package/react-markdown.md) ^10.1.0
- [@floating-ui/react](https://npm.io/package/@floating-ui/react.md) ^0.27.16
- [@tanstack/react-virtual](https://npm.io/package/@tanstack/react-virtual.md) ^3.13.18
- [remark-github-blockquote-alert](https://npm.io/package/remark-github-blockquote-alert.md) ^2.0.1

## Recent versions

- 2.6.0 (latest) — 2026-11-12
- 1.0.0-rc.6 (next) — 2026-04-02
- 2.5.0 — 2026-11-09
- 2.4.0 — 2026-10-20
- 2.3.0 — 2026-10-16
- 2.2.0 — 2026-10-15
- 2.1.0 — 2026-09-24
- 2.0.2 — 2026-09-03
- 2.0.1 — 2026-09-01
- 2.0.0 — 2026-08-27
- 1.0.0-rc.5 — 2026-03-19
- 1.0.0-rc.4 — 2026-03-19
- 1.0.0-rc.3 — 2026-03-18
- 1.0.0-rc.2 — 2026-03-16
- 1.0.0-rc.1 — 2026-03-16
- … 151 more at https://npm.io/package/@k8slens/lds/versions

## README

# Lens Design System

A React component library for building any surface — dashboards, admin panels, Electron apps, CLI/TUI tools, and beyond. Originally created for [Lens Desktop](https://k8slens.dev/), LDS is a general-purpose design system for the broader Lens product portfolio and any product that needs a cohesive, dark-theme-optimized UI.

![npm](https://img.shields.io/npm/v/@k8slens/lds?style=flat&logo=npm&color=CB3837)
![React](https://img.shields.io/badge/React-18+-61DAFB?style=flat&logo=react&logoColor=white)
![TypeScript](https://img.shields.io/badge/TypeScript-5+-3178C6?style=flat&logo=typescript&logoColor=white)

- 🎨 **Dark theme optimized** for long working sessions
- 📦 **42+ components** covering navigation, controls, data visualization, layout, and more
- 🎯 **Design tokens** as CSS custom properties (`--lds-*`)
- 📐 **Density system** — one setting sizes a whole page coherently, from a 22px table row to a 64px editorial hero
- 🖥️ **Multi-target** — Web and Terminal UI (Ink) from a shared codebase
- 🤖 **AI-ready** — ships `llms.txt` and a style guide your coding agent can read

## Installation

```bash
npm i @k8slens/lds
```

Import the stylesheet once in your app entry, then use components:

```tsx
import '@k8slens/lds/style.css';
import { Button } from '@k8slens/lds';

<Button variant="primary" onClick={handleClick}>
  Create Resource
</Button>
```

### Entry points and optional peer dependencies

The main entry has **no heavy dependencies**. Components that need one live behind
their own entry point, and that dependency is an **optional peer dependency** —
you install it only if you import that entry. So an LDS-powered marketing page or
a simple dashboard never downloads a code editor or a graph engine.

| Import | Install alongside it | Component |
|--------|----------------------|-----------|
| `@k8slens/lds` | *nothing* | everything below except the four rows here |
| `@k8slens/lds/charts` | `uplot` | `TimeSeries` + `TimeSeriesControls` |
| `@k8slens/lds/resource-map` | `@xyflow/react` `dagre` | `ResourceMap` |
| `@k8slens/lds/code-editor` | `@monaco-editor/react` | `CodeEditor` |
| `@k8slens/lds/terminal` | `ink` | Terminal (Ink) components |

```bash
npm i @k8slens/lds                               # core components
npm i @k8slens/lds @xyflow/react dagre           # + ResourceMap
```

Each of those entries also imports its dependency's stylesheet, which your
bundler resolves automatically — no extra CSS import needed.

```tsx
// Web components (default)
import { Button } from '@k8slens/lds';

// Terminal components
import { ButtonTerminal } from '@k8slens/lds/terminal';
```

### Stylesheets

| Import | Size | Contents |
|--------|------|----------|
| `@k8slens/lds/style.css` | ~211 KB | all `--lds-*` tokens **plus** every component's styles |
| `@k8slens/lds/tokens.css` | ~26 KB | the token layer only — colors, spacing, typography, radii |

Import `style.css` when you use LDS components. Import `tokens.css` when you only
need the design tokens — for example a Tailwind theme that maps onto `--lds-*`
variables, or a marketing site with its own components.

## Design tokens

All design tokens are CSS custom properties with the `--lds-` prefix:

```css
/* Colors */
--lds-color-bg-primary: #181A1C;
--lds-color-text-primary: #aaacae;
--lds-color-primary: #3d90ce;

/* Spacing (4px base unit) */
--lds-space-1: 4px;
--lds-space-2: 8px;

/* Typography */
--lds-font-size-md: 13px;
```

```tsx
import '@k8slens/lds/tokens.css';
```

## Density

Declare a density once and the whole subtree fits together — text, icons, padding,
radii, gaps, and nested controls all derive from it:

```tsx
<DensityProvider density="comfortable">
  <Dashboard />   {/* 44px rows holding 36px controls */}
</DensityProvider>
```

or with no React at all, which is all a stylesheet needs:

```html
<div data-density="editorial">…</div>
```

| density | rows | controls | intended for |
|---|---|---|---|
| `compact` | 22px | 18px | dense desktop: tables, trees, status bars |
| `standard` | 34px | 26px | Lens Desktop default |
| `comfortable` | 44px | 36px | web admin dashboards |
| `editorial` | 64px | 48px | marketing sites |

Within a density there are three rungs — `surface` ⊃ `control` ⊃ `embedded` — so a row
is always sized to carry the controls placed in it, and a control nested inside another
control (the clear button in a search field) is smaller again.

Individual components take a `density` prop to override their surroundings:

```tsx
<Toolbar density="compact">
  <Button />   {/* 18px: the control rung inside a 22px surface */}
</Toolbar>
```

Components that are not meaningful at every density clamp themselves rather than
render nonsense — a `TreeView` inside an editorial page becomes `standard`, not 64px
per row.

## Usage examples

### Data table

```tsx
import { DataTable, StatusIndicator, Badge } from '@k8slens/lds';

<DataTable
  data={pods}
  columns={[
    { key: 'name', header: 'Name', width: '1fr', sortable: true },
    { key: 'namespace', header: 'Namespace', width: '140px',
      render: (pod) => <Badge>{pod.namespace}</Badge>
    },
    { key: 'status', header: 'Status', width: '120px',
      render: (pod) => <StatusIndicator status={pod.status} label={pod.statusLabel} />
    },
  ]}
  getRowKey={(pod) => pod.id}
  onRowClick={setSelectedPod}
/>
```

### Density override on a button

```tsx
import { Button, RefreshIcon } from '@k8slens/lds';

{/* Density is inherited; pass it only to override the surrounding context. */}
<Button variant="ghost" density="compact" iconOnly icon={<RefreshIcon />} />
```

## API reference for humans and agents

Two reference documents ship inside this package:

- **`llms.txt`** — the full component inventory and API reference, written for
  coding agents. Point your editor's AI at
  `node_modules/@k8slens/lds/llms.txt` and it knows every component, prop, and token.
- **`lens-style-guide.md`** — what "looks like Lens" means: the visual language
  and how to compose LDS components to achieve it.

Working from the LDS source repository instead? Start at
[`docs/CONSUMERS.md`](docs/CONSUMERS.md).

## Changelog

See `CHANGELOG.md`, shipped with the package.

## License

Apache License 2.0 — Copyright 2026 Mirantis, Inc.

---
_Source: https://npm.io/package/@k8slens/lds · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
