p
p
p
p
p
p
Developer Documentation
Include the CSS and JS files in your HTML. The JS file is optional but recommended for progressive enhancements.
<link rel="stylesheet" href="granum.min.css">
<script src="granum.min.js" defer></script> <!-- optional -->It is possible to include core styles and icons separately or skip icons completely.
<link rel="stylesheet" href="granum.core.min.css">
<link rel="stylesheet" href="granum.icons.min.css"> <!-- optional -->
<script src="granum.min.js" defer></script> <!-- optional -->To make a page mobile-friendly and responsive, include the viewport meta tag into the <head>.
<meta name="viewport" content="width=device-width, initial-scale=1">Use .row for horizontal layouts. Add .wrap to allow wrapping, and .gap for spacing.
Use .grid-* to create responsive grids that automatically fill available space based on minimum cell widths.
Use .columns-* for columns.
Use .stack to avoid outer margins. Use .stack.line to add borders between items.
Paragraph 1
Paragraph 2
Paragraph 3
Use .stick to stick an element to the top or bottom.
p
p
p
p
p
p
Use .resize on child nodes of the same .row container.
| Table |
|---|
| Value |
| Some very long text written to trigger horizontal scroll |
Text
Link
Unlink
Bold Strong
Italic Emphasis
Ins
Del
Mark
Code
Kbd
Quote
Cite
Definition
Small
Abbr
xsub
xsuper
Block quote
Preformatted text
Code: var = value
Sans serif Serif Monospace Small Regular-size Bold Middle
No auto wrap. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent tristique purus nec erat suscipit, eget rhoncus ipsum porta.
Paragraph
Paragraph
Default
Neutral
Note
Info
Success
Warning
Danger
| Name | Number | Date | String |
|---|---|---|---|
| Alice | 0 | 01.07.2000 | Coffee |
| Ben | 100 | 02.02.2000 | Water |
| Charlie | -22 | 01.07.2025 | Juice |
| Dan | 15 | 01.12.2024 | Tea |
| Total | 93 |
Apply contextual colors to text, backgrounds, or borders using utility classes.
Invert the entire page or just specific element. Enable dark mode in your browser or OS. Or check the following checkboxes.
Use .form.resp for aligned, responsive form layouts.
Inside .form, use .tip > .success, .tip > .danger after input for tips.
Use .form.lazy to show tips only after user interaction.
Use button.detect to enable the button only if the form is valid.
Enhanced with JavaScript
Customized dropdown <select>-like input using [popover] and radio buttons.
JavaScript sets focus after opening, copies value to button's first span text and closes popover after selection, enables filtering.
Use .input wrapper for composite input.
Use .dropzone for file input to turn it in a drop zone.
Container options:
Pure CSS, no JavaScript required.
Requires Invoker Commands API.
Closes on Escape key, command button, or click outside.
Has styleable ::backdrop.
Traps focus.
Autofocus.
Nestable.
Appearance transition.
Show in hash :target match (with JS).
Use [popover].
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
Enhanced with JavaScript
Controlled via hash links.
:checkedUse .check on the label or checkbox to toggle the following element.
:targetEnhanced with JavaScript
Use .target on target element. Add .act on link for initially opened state. Add .mem on target element for state persistance. Add .toggle on hash link for JS enhancements (toggle off and avoid page jump).
:targetEnhanced with JavaScript
:targetDeprecated
Triggered via URL hash fragments. Pure CSS, no JavaScript required!
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
p
Using native <details> elements.
Enhanced with JavaScript
Using a :hover state. Add .pos for automatic positioning with JS.
[data-hint]Deprecated
display to default (block for div)
Show/hide elements based on viewport or .container width. Resize your browser window or container to see them appear/disappear.
Show/hide elements based on JavaScript availability.
Hide elements when printing.
mask-imageSome icons switch in active mode (.act, :has(+:target), .check:has(:checked), [open]>summary). Click icons to toggle.
Requires JavaScript
[data-nodes])Toggle CSS classes on target elements based on input state.
#open)Add .keep to a list item to exclude it from filtering.
Emits granum-filter event.
Click the headers to sort, or type in the search box to filter.
Add .keep to a row to exclude it from filtering.
Emits granum-filter and granum-sort events.
| Name | Number | Date | String |
|---|---|---|---|
| Alice | 0 | 01.07.2000 | Cafe |
| Dan | 150.50 km | 2024-12-01 | café |
| ben | 150.15 km | 02.02.2000 | café |
| Charlie | -22 | 7/1/2025 | coffee |
| No name | - |
.mem)Type something below, then refresh the page. Input values and details state are saved to the localStorage.
[data-get])
Operates on closest div, ul, tr parent by default.
To override, define selector in [data-item] (for closest parent) or in [data-src] (global selector).
To keep at least one item, add .keep to the #item-del link.
Emits granum-manage event.
Use .drag-container, table, ul as container,
.drag-item for items,
and a[href="#drag"] for handler.
For correct work on touch devices, .drag-container is strictly required.
Emits granum-drag event.
All granum-* custom events bubble and are cancelable.
Occurs after filtering a list or table.
granum-filterOccurs after sorting a table.
granum-sort1 for ascending, -1 for descendingOccurs after applying a drag sort.
granum-dragOccurs after managing items.
granum-managedel for delete, up for move up, down for move down, copy for create a copy)copy action contains source item)copy action)