Getting Started

Contents

What ships inside the @milvikbima/ui package — the pre-built bundles, the raw design tokens, the source layout, and the exports map that wires them up.

Overview

BIMA UI is published to NPM as @milvikbima/ui (currently v). The package contains three things: the shippable dist bundle you link in production, the raw tokens that are the source of truth for every value, and the src CSS layers the bundle is built from. Everything is dependency-free vanilla CSS and JS.

For most projects you only need dist/bima.css (and optionally dist/bima.js). The tokens and src directories are there for token-only consumers and for building from source. See Webpack & Bundlers for the import recipes.

Distribution files

The dist/ directory holds the bundles intended for production. The .min variants are minified; the un-minified versions are easier to read and debug. Link the CSS always; the JS only when you use interactive components.

File Approx. size What it is
dist/bima.css ~170 KB The full, un-minified stylesheet — every layer concatenated. Use during development for readable output and source maps.
dist/bima.min.css ~90 KB Minified stylesheet for production. Identical rules, whitespace and comments stripped.
dist/bima.js ~60 KB Dependency-free interactive behaviour (modal, accordion, tabs, dropdown, toast, carousel, custom select, offcanvas, tooltip, scrollspy). Exposes window.BIMA.
dist/bima.min.js ~55 KB Minified script for production. Same API as bima.js.
tokens/variables.css ~19 KB The raw --bima-* design tokens on :root — colours, type, spacing, radius, shadows, motion, z-index. Import this alone when theming Tailwind / Ant / MUI.

Sizes are approximate and uncompressed. Over the wire with gzip or brotli the CSS is dramatically smaller. Always serve the .min files in production.

What's inside bima.css

The bundle is not a single hand-written file — it is built by concatenating the source layers in a fixed order. Knowing the order helps when you reason about the cascade. dist/bima.css is, in sequence:

variables   →  tokens/variables.css      (all --bima-* custom properties)
reboot      →  tokens/reboot.css         (cross-browser element reset)
content     →  src/css/content.css       (typography & prose defaults)
grid        →  src/css/grid.css          (responsive container + 12-col grid)
components  →  tokens/bima.css           (buttons, forms, cards, modal, …)
carousel    →  src/css/carousel.css      (carousel component)
helpers     →  src/css/helpers.css       (ratios, position, visibility helpers)
utilities   →  tokens/bima-utilities.css (spacing, flex, text, colour utilities)
extensions  →  src/css/extensions.css    (additional component extensions)

Because variables.css is first, every layer after it can resolve var(--bima-*). Because utilities come late, a utility class such as .bima-mt-4 reliably overrides a component's default margin.

Source layout

The package also ships the raw source so you can build a custom bundle or import an individual layer. The two directories that matter are tokens/ and src/css/.

Path Contents
tokens/variables.css The design tokens — the single source of truth for all values.
tokens/design-tokens.json The same values in a machine-readable form for Figma / Style Dictionary pipelines.
tokens/reboot.css The element reboot — a token-driven cross-browser normalisation layer.
tokens/bima.css The component layer — buttons, forms, cards, dropdown, modal, accordion, and more.
tokens/bima-utilities.css The utility classes — spacing, flexbox, text, colour, all bima- prefixed.
src/css/content.css Long-form typography and prose defaults.
src/css/grid.css The responsive container and 12-column grid system.
src/css/carousel.css The carousel component styles.
src/css/helpers.css Helper classes — aspect ratios, positioning, visibility.
src/css/extensions.css Additional component extensions layered on top of the core.
js/bima.js The authored, un-bundled interactive behaviour source.

Package exports

The exports map in package.json defines every entry point a bundler can resolve. Import the named export rather than reaching into the package's file tree directly — the map is the supported contract.

// package.json — exports map
{
  "exports": {
    ".":              "./dist/bima.css",      // import "@milvikbima/ui"
    "./css":          "./dist/bima.css",
    "./css/min":      "./dist/bima.min.css",
    "./js":           "./dist/bima.js",
    "./js/min":       "./dist/bima.min.js",
    "./tokens":       "./tokens/variables.css",

    // explicit file aliases
    "./bima.css":     "./dist/bima.css",
    "./bima.min.css": "./dist/bima.min.css",
    "./bima.js":      "./dist/bima.js",
    "./bima.min.js":  "./dist/bima.min.js",
    "./tokens/variables.css": "./tokens/variables.css",

    // individual source layers
    "./src/css/grid":     "./src/css/grid.css",
    "./src/css/helpers":  "./src/css/helpers.css",
    "./src/css/carousel": "./src/css/carousel.css",
    "./src/css/content":  "./src/css/content.css"
  }
}

The most common imports map to memorable names:

Import specifier Resolves to Use when
@milvikbima/ui / @milvikbima/ui/css dist/bima.css You want the full framework.
@milvikbima/ui/css/min dist/bima.min.css Production build, minified CSS.
@milvikbima/ui/js dist/bima.js You use interactive components.
@milvikbima/ui/tokens tokens/variables.css Theming Tailwind / Ant / MUI — values only, no component CSS.
@milvikbima/ui/src/css/grid src/css/grid.css You want only one source layer (e.g. just the grid).

The package's files array publishes dist, tokens, js, and src (plus the README and changelog), and sideEffects is set to ["*.css"] so bundlers keep your CSS imports during tree-shaking.

Next steps

Now that you know what's in the box, wire it into your build or theme it: