@anyblades/blades

中文文档
3.1.1发布于 2026/11/04MIT零依赖近 30 天下载 2.9万

A modern drop‑in successor to Pico CSS.

原始使用文档
文档目录11 节
  1. Quick start
  2. A. Install manually
  3. B. Usage from CDN
  4. C. Install with NPM
  5. D. Official starters
  6. Starter HTML template
  7. Documentation
  8. Dark mode without a flash
  9. Compact sizing (opt-in)
  10. Trusted by
  11. 🥷✨

blades✨

Minimal CSS Framework for Semantic HTML

Blades CSS is a modern drop‑in successor to Pico CSS.

Just switch pico.css to blades.css— and voilà!

Get started ›  •  Inspired by Pico ✨

Quick start

There are 4 ways to get started:

A. Install manually

Download CSS archive and link css/blades.css in the <head> of your website.

<link rel="stylesheet" href="css/blades.css" />

B. Usage from CDN

<link rel="stylesheet" href="
  https://cdn.jsdelivr.net/npm/@anyblades/blades@3/css/blades.min.css
"/>

Live example: https://github.com/pallets/website/blob/main/src/pallets/templates/layout.html

Full list of CSS files available on CDN: https://cdn.jsdelivr.net/npm/@anyblades/blades@3/css/

C. Install with NPM

npm install @anyblades/blades

Then, @import Blades into your CSS file:

@import "@anyblades/blades";

Alternatively, import only the parts you need, e.g. per page or per component. They come wrapped in @layer blades, so your unlayered styles win over them:

@import "@anyblades/blades/variables";
@import "@anyblades/blades/layout/document";
@import "@anyblades/blades/content/typography";
@import "@anyblades/blades/components/card";
@import "@anyblades/blades/components/modal";
  • variables and layout/document are the minimum; keep the same order as src/pico/_index.css.
  • Some parts build on others, e.g. components/modal expects components/card, and components/group and components/dropdown expect forms/basics and content/button.
  • See Layered modules for the available parts, and for importing them from JavaScript in bundlers and component frameworks (SvelteKit, Next.js, Nuxt, Astro, …).
  • See package.json for a list of all exported parts.

D. Official starters


Starter HTML template

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta name="color-scheme" content="light dark" />
    <link rel="stylesheet" href="css/blades.css" />
    <title>Hello world!</title>
  </head>
  <body>
    <main class="container">
      <h1>Hello world!</h1>
    </main>
  </body>
</html>

Using Nunjucks, Twig or Liquid? Check out the built-in Base HTML templates for each engine, ready to be used in your project.


Documentation

If you know Pico — you already know Blades:

Dark mode without a flash

With the Pico-based builds, Blades follows the OS setting by default, with no JavaScript and no flash (see Dark scheme). To force a theme, set data-theme="light" or "dark" on <html>. On a nested element it works when the element paints its own background, such as <article>; otherwise add background-color: var(--pico-background-color); color: var(--pico-color);.

If you persist the user's choice, e.g. under the localStorage key theme, set the attribute before the first paint with a small inline script in <head>, e.g. in SvelteKit's src/app.html:

<script>
  try {
    const theme = localStorage.getItem("theme");
    if (theme === "light" || theme === "dark") document.documentElement.dataset.theme = theme;
  } catch {}
</script>
  • Setting it later, e.g. in onMount or useEffect, renders the OS theme first and then switches.
  • In a Next.js App Router layout, pass the same code as a template literal, <script dangerouslySetInnerHTML={{ __html: `try { … } catch {}` }} />, and add suppressHydrationWarning to <html>, because the attribute changes before hydration.

Compact sizing (opt-in)

Add <html data-compact> for the whole page, or put the attribute on a single element, e.g. <form data-compact> for one form. Without the attribute nothing changes.

  • Where it ships:
    • included in blades.css
    • also in blades.layered.css
    • with per-part imports, add @anyblades/blades/compact after the other parts
    • with pico.conditional.css, add @anyblades/blades/src/compact after it
  • What changes:
    • smaller control padding and 1.5rem block spacing
    • a 0.5rem radius and a 3px focus ring
    • 500-weight labels and buttons, 600-weight headings
    • a white field background in light mode
    • a 1px card ring instead of the blurred shadow, with no grey card header/footer bands
  • Root font size: on <html>, it also keeps the root font size at 100% instead of growing with the viewport. At 1280px wide, controls are then 38px instead of 62px. On a single element they are about 48px, because everything is sized in rem and the root stays as it is.
  • Field text size: form controls stay at 16px, because below that iOS Safari zooms in on focus.

Trusted by


🥷✨

版本与发布记录

@anyblades/blades 共发布 42 个版本,首次发布于 2026/04/07;过去 12 个月发布了 42 个版本。

版本发布日期距今
3.1.1latest2026/11/042 天前
3.1.02026/11/033 天前
3.1.0-rc.12026/10/298 天前
3.1.0-beta.7canary2026/10/2611 天前
3.1.0-beta.62026/10/2512 天前
3.1.0-beta.52026/10/2314 天前

其他发布通道:alpha → 0.28.0-alpha.8,canary → 3.1.0-beta.7。

关于 @anyblades/blades 的常见问题

@anyblades/blades 是什么?

A modern drop‑in successor to Pico CSS.

如何安装 @anyblades/blades?

在项目目录运行 npm install @anyblades/blades,或使用 pnpm add / yarn add / bun add。

@anyblades/blades 支持 TypeScript 吗?

该包的 package.json 没有声明类型入口。需要类型提示时,可以在 npm 上查找社区维护的 @types/anyblades__blades 是否存在。

@anyblades/blades 可以商用吗?

@anyblades/blades 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@anyblades/blades 的下载量有多少?

根据 npm 官方下载统计,@anyblades/blades 在 2026/10/06 – 2026/11/04 这 30 天内被下载 29,241 次,日均约 975 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@anyblades/blades 还在维护吗?

最新版本 3.1.1 发布于 2026/11/04(2 天前);至今共发布 42 个版本,其中过去 12 个月发布了 42 个;首次发布于 2026/04/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。