Advanced
Asset loading
The Full, Core, component and extension files, their formats, and the order to load them in.
Bundles
Full is Core plus every standard component; for smaller pages, load Core and only the components you use. Preflight, the icons and the extensions sit outside both: load them only on pages that need them.
| Bundle | Contents | CSS | Browser script | ESM import |
|---|---|---|---|---|
| Full | Core and every standard component | pelatform-ui. |
pelatform-ui. |
@pelatform/ui/css, @pelatform/ui |
| Core | Tokens, foundation, utilities and the init/destroy runtime |
core/pelatform-ui-core. |
core/pelatform-ui-core. |
@pelatform/ui/core/css, @pelatform/ui/core |
| Preflight | An optional reset of the elements inside a root, outside Full and Core | core/pelatform-ui-preflight. |
None | @pelatform/ui/preflight/css |
| Component | One component, without Core | components/{name}. |
components/{name}. |
@pelatform/ui/components/{name}/css, @pelatform/ui/components/{name} |
| Extension | One optional extension, outside Full | extensions/{name}. |
extensions/{name}. |
@pelatform/ui/extensions/{name}/css, @pelatform/ui/extensions/{name} |
| Icons | Every outline icon, or every filled one, outside Full | icons/icons., icons/icons-filled. |
None | @pelatform/ui/icons/css, @pelatform/ui/icons-filled/css |
The Full script starts itself once at DOM readiness, also when it loads later, and an extension script loaded after it starts its own elements; Core and component scripts never start themselves, so call PLF.init() after they load. You can choose Full or single files separately for CSS and JavaScript, such as Full CSS with Core and component scripts, but never load a file that a Full file already provides. CSS-only components have no script.
Preflight resets every element inside a root, so markup built with the utilities spaces as these docs show, also beside a site’s own CSS; load it before Core or Full.
The icon stylesheets give the icon classes their icons, drawn by the icon class in Core; load them after Core or Full, only on pages with icon classes.
Formats
Each bundle comes in these formats. Normal and minified files are alternatives with the same declarations and behavior; a document loads one CSS mode, one runtime format and one version.
| Variant | Files | Use |
|---|---|---|
| Clean CSS | ., . |
Clean class names such as btn |
| Prefixed CSS | ., .; ESM /css/prefixed |
plf: class names, as in Installation |
| Browser script | ., .; ESM @pelatform/ui/browser and /browser/min for the Full script |
A classic <script> that attaches window.; no bundler or module type |
| ESM | @pelatform/ui exports with shared chunks and type declarations |
Bundlers; imports never start components or attach window. |
CSS order
Stylesheets load in this layer order: tokens → foundation → utilities → components → extensions → consumer overrides.
| Layer | Comes from |
|---|---|
| Tokens, foundation, utilities | Core, or Full |
| Components | Full, or component files in the order of the components list in manifest. |
| Extensions | Extension files, after the components they need, and the icon stylesheets |
| Consumer overrides | Your stylesheet, last |
Core and components
Load Core first, then each component’s CSS and script, then call PLF.init():
<link rel="stylesheet" href="core/pelatform-ui-core.min.css">
<link rel="stylesheet" href="components/modal.min.css">
<script src="core/pelatform-ui-core.min.js" defer></script>
<script src="components/modal.min.js" defer></script>
<script>document.addEventListener('DOMContentLoaded', () => PLF.init());</script>With ESM, import the CSS yourself, as JavaScript imports never import CSS, and register the components with use() so that init() starts them:
import '@pelatform/ui/core/css';
import '@pelatform/ui/components/modal/css';
import {init, use} from '@pelatform/ui/core';
import {Modal} from '@pelatform/ui/components/modal';
use(Modal);
init();Extensions
Calendar, Date Picker, Date & Time Picker, Color Picker, DataTable, Chart and Sortable are not in Full or the ESM root. Load their files after the components they need: after the Full script they start themselves, and with Core, call PLF.init(); Extensions lists the files.
Types
The package includes type declarations, which editors also use for autocomplete in JavaScript; they need moduleResolution set to bundler or nodenext. Each ESM import carries its types, such as ModalInstance and ModalEventDetail, and an event listener knows its detail, such as event.detail.reason on plf:modal:close.
With the Browser script, add the global PLF with this line at the top of a script file, or for every file by listing @pelatform/ui/browser in the types of jsconfig.json (tsconfig.json in TypeScript):
/// <reference types="@pelatform/ui/browser" />An extension is on PLF once its script loads, so its type is optional: PLF.DataTable?.getInstance(table).
Package metadata
The runtime never loads these files.
| File | Contents |
|---|---|
manifest. (@pelatform/ui/manifest) |
Schema and release version, inventory, modes, normal and minified paths, dependencies, provided IDs, the scripts a CSS-only component uses (uses), the elements each script starts on (selector), the format each export adapter adds (exportFormat), ESM and type entries, raw, gzip and Brotli sizes |
class-map. (@pelatform/ui/class-map) |
Each plf: visual class and its Clean name, for build tools |
tailwind. (@pelatform/ui/tailwind) |
A Tailwind CSS theme for your own build, whose utilities read the tokens (Installation) |
tabler-notices., extensions/chart-notices., extensions/datatable-export-notices. |
License notices; keep them with redistributed files |
Compact control sizes
Controls share three minimum heights and grow with larger fonts or content; Default has no modifier and there is no --md class.
| Size | Modifier | Minimum height | Decorative icon |
|---|---|---|---|
| Small | --sm |
32px | 14px |
| Default | None | 36px | 16px |
| Large | --lg |
40px | 18px |
| Control | Classes |
|---|---|
| Button | btn-sm, btn-lg |
| Input | input-sm, input-lg |
| Textarea | textarea-sm, textarea-lg; height follows its rows |
| Input Group | input-group-sm, input-group-lg on the group; do not size the inner input |
| Select | select-sm, select-lg, also on a custom select |
| Combobox | combobox-sm, combobox-lg |
| Multi Select | multi-select-sm, multi-select-lg |
A component’s own height, radius or icon variable on a root or element takes precedence over the modifiers; --plf-control-font-size, --plf-control-font-weight and --plf-control-icon-size set the shared defaults (Tokens). Use Small for dense toolbars and forms and Default or Large for touch input. A native select can show the platform’s own corner radius, as in WebKit.
Some mobile browsers zoom into a field whose text is smaller than 16px when it gets focus. To avoid it, set --plf-control-font-size: 16px on the root.
Component assets
Load Core, then the files under Also load, then the component’s CSS and the scripts under JavaScript, which can belong to another component (Sheet’s behavior is components/modal.js). Each file has a minified .min version and Prefixed markup uses the .prefixed.css files; a component guide’s JavaScript section lists the files its examples use.
| Component | CSS | JavaScript | Also load | ESM export |
|---|---|---|---|---|
| accordion | components/accordion. | None | None | None |
| alert | components/alert. | None | None | None |
| alert-dialog | components/alert-dialog. | components/modal. | components/button., components/modal. | Modal |
| aspect-ratio | components/aspect-ratio. | None | None | None |
| attachment | components/attachment. | None | None | None |
| avatar | components/avatar. | None | None | None |
| badge | components/badge. | None | None | None |
| breadcrumb | components/breadcrumb. | None | None | None |
| button | components/button. | components/button. | None | Button |
| button-group | components/button-group. | None | components/button. | None |
| card | components/card. | None | None | None |
| carousel | components/carousel. | components/carousel. | None | Carousel |
| choice-card | components/choice-card. | None | components/form. | None |
| code-block | components/code-block. | components/code-block. | None | CodeBlock |
| collapsible | components/collapsible. | None | None | None |
| combobox | components/combobox. | components/combobox. | None | Combobox |
| command | components/command. | components/command. | None | Command |
| context-menu | components/context-menu. | components/context-menu. | components/dropdown-menu. | ContextMenu |
| drawer | components/drawer. | components/modal. | components/modal., components/sheet. | Modal |
| dropdown-menu | components/dropdown-menu. | components/dropdown-menu. | None | DropdownMenu |
| empty | components/empty. | None | None | None |
| field | None | components/field. | None | Field |
| file-upload | components/file-upload. | components/file-upload. | components/attachment. | FileUpload |
| form | components/form. | None | None | None |
| hover-card | components/hover-card. | components/hover-card. | None | HoverCard |
| input-group | None | components/input-group. | None | InputGroup |
| input-otp | components/input-otp. | components/input-otp. | components/form. | InputOTP |
| item | components/item. | None | None | None |
| kbd | components/kbd. | None | None | None |
| lightbox | components/lightbox. | components/lightbox. | components/button., components/modal., components/spinner., components/modal. | Lightbox |
| link | components/link. | None | None | None |
| menubar | components/menubar. | components/menubar. | components/dropdown-menu., components/dropdown-menu. | Menubar |
| mockup | components/mockup. | None | None | None |
| modal | components/modal. | components/modal. | None | Modal |
| multi-select | components/multi-select. | components/multi-select. | None | MultiSelect |
| navigation-menu | components/navigation-menu. | components/navigation-menu. | None | NavigationMenu |
| number-input | None | components/number-input. | None | NumberInput |
| pagination | components/pagination. | None | None | None |
| phone-input | None | components/phone-input. | None | PhoneInput |
| popover | components/popover. | components/popover. | None | Popover |
| progress | components/progress. | None | None | None |
| repeater | components/repeater. | components/repeater. | None | Repeater |
| resizable | components/resizable. | components/resizable. | None | Resizable |
| result-dialog | components/result-dialog. | components/modal. | components/button., components/modal. | Modal |
| scroll-area | components/scroll-area. | None | None | None |
| scrollspy | components/scrollspy. | components/scrollspy. | None | Scrollspy |
| select | components/select. | components/select. | components/form. | Select |
| separator | components/separator. | None | None | None |
| sheet | components/sheet. | components/modal. | components/modal. | Modal |
| sidebar | components/sidebar. | components/sidebar. | components/modal., components/sheet., components/tooltip., components/collapsible., components/modal. | Sidebar |
| skeleton | components/skeleton. | None | None | None |
| slider | components/slider. | components/slider. | None | Slider |
| spinner | components/spinner. | None | None | None |
| stepper | components/stepper. | components/stepper. | components/progress. | Stepper |
| table | components/table. | None | None | None |
| tabs | components/tabs. | components/tabs. | None | Tabs |
| textarea-grow | None | components/textarea-grow. | None | TextareaGrow |
| theme-switch | None | components/theme-switch. | components/dropdown-menu., components/toggle-group. | ThemeSwitch |
| time-picker | None | components/time-picker. | None | TimePicker |
| timeline | components/timeline. | None | None | None |
| toast | components/toast. | components/toast. | components/alert. | Toast |
| toggle | components/toggle. | components/toggle. | components/button. | Toggle |
| toggle-group | components/toggle-group. | components/toggle-group. | components/button., components/button-group., components/toggle. | ToggleGroup |
| tooltip | components/tooltip. | components/tooltip. | None | Tooltip |
| tree-view | components/tree-view. | components/tree-view. | None | TreeView |