Skip to content
Projets

À propos

Fork direct et moderne de Pico CSS. Remplacez `pico.css` par `blades.css` et gardez les mêmes variables ⁠‑⁠⁠‑⁠pico‑⁠*. Et voilà ! ✨

Développement web et applicatif

Comment ces chiffres sont mesurés

Progression mesurée des étoiles

in 24h
+3
in 7 days
+8
in 15 days
+24
in 1 month
Historique en cours

Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.

README.md

Original

[!IMPORTANT] We moved from a single-project organization to the Sveti Foundation umbrella, strengthening our growing ecosystem.

npm packages are now under the @sveti/ scope.

blades✨

Minimal CSS Framework for Semantic HTML

Blades CSS is a modern, direct fork of Pico CSS.

Switch pico.css to blades.css with the same ⁠‑⁠⁠‑⁠pico‑⁠* vars, and voilà!


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/@sveti/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/@sveti/blades@3/css/

C. Install with NPM

npm install @sveti/blades

Then, @import Blades into your CSS file:

@import "@sveti/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 "@sveti/blades/variables";
@import "@sveti/blades/layout/document";
@import "@sveti/blades/content/typography";
@import "@sveti/blades/components/card";
@import "@sveti/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 @sveti/blades/compact after the other parts
    • with pico.conditional.css, add @sveti/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


🥷✨

Explorer des projets similaires

Chargement…