mosaddik ui

The buttons, fields, colors and type every mosaddik.dev tool is built from. Plain CSS and one small optional script, with no framework and no build step.

Password generator Built only from this kit
20

Install

Add two lines to any page. The script is only needed for menus, dialogs, tabs, toasts, copy buttons and the theme switch.


<link rel="stylesheet" href="https://ui.mosaddik.dev/v1/mosaddik.css">
<script src="https://ui.mosaddik.dev/v1/ui.js" defer></script>

Theme without a flash

The page follows the system theme until someone picks one. Put this in the head, before the stylesheet, so a saved choice applies before first paint.


<script>try{const t=localStorage.getItem("m-theme");if(t)document.documentElement.dataset.theme=t}catch{}</script>

<!-- a button anywhere switches it -->
<button class="m-btn m-btn--ghost m-btn--icon" data-theme-toggle aria-label="Dark theme">…</button>

Load only what you need

mosaddik.css imports four files. Apps that host their own fonts can skip fonts.css and load the rest in this order.


<link rel="stylesheet" href="https://ui.mosaddik.dev/v1/tokens.css">
<link rel="stylesheet" href="https://ui.mosaddik.dev/v1/base.css">
<link rel="stylesheet" href="https://ui.mosaddik.dev/v1/components.css">

Icons and versions

Icons are Lucide, drawn at 16px with a 1.75 stroke, in the color of the text next to them. Code samples on this page mark where an icon goes. Anything under /v1/ only gets fixes. A change that could break a page ships as /v2/.

In React

Use the same classes. Write class as className and the rest is identical.


<button className="m-btn m-btn--primary" onClick={save}>Save changes</button>

Rules

The kit only stays consistent if every tool follows the same few rules.

Do
  • One primary button per screen, in ink
  • Signal orange only for the single most important thing, like a record button or a selection
  • Sentence case on every label, with no period at the end
  • Name buttons by what they do: Download PNG, not Submit
  • Tabular numbers for sizes, times and counts
Don't
  • Gradients, glows and colored shadows
  • Emoji as icons, or icons on every heading
  • Uppercase labels with wide letter spacing
  • Exclamation marks in interface text
  • Badges like New or Pro that don't reflect real state

Color

Warm paper neutrals, one accent and four colors that carry meaning. Every value has a dark twin, so switch the theme to see both.

Surfaces and lines

Text

Accent

Use it on about two percent of a screen. If two things on one screen are orange, one of them is wrong.

Meaning

Only for state. Each has a soft version for backgrounds, like --m-ok-soft.

Type

One family for the interface, one for Bangla and one mono for anything you compare by eye. Two weights, 400 and 500. Size and color make the hierarchy.

Aa
Schibsted Grotesk
Interface and text
অআক
Anek Bangla
Bangla text, with lang="bn"
0→1
Fragment Mono
Code, file sizes, counts

Scale

Spacing

Every gap, padding and fixed height is a step on a 4px grid. Space inside a group is smaller than space between groups.

Shape and depth

An inner corner equals the outer corner minus the padding between them. Depth comes from hairlines and surface steps first, and shadows only for things that float.

--m-radius-sm5px · tags, keycaps
--m-radius8px · buttons, fields
--m-radius-lg12px · cards
--m-radius-xl16px · dialogs
--m-radius-fullswitches only
Hairline
Resting cards
--m-shadow-sm
Buttons, raised cards
--m-shadow-pop
Menus, toasts
--m-shadow-dialog
Dialogs

Motion

One curve, three durations. Motion explains a change and stops. Nothing loops unless work is really happening, and everything respects reduced motion.

--m-fast140ms · hover, press
--m-base200ms · menus
--m-slow360ms · entrances

Button

Primary is ink and appears once per screen. Secondary does everything else. Signal is for the one action a tool exists for, like Record. Ghost sits in toolbars.

States

Hover with a mouse, press, or tab to a button to see these live. The grid shows each state still.

DefaultHoverPressedFocusDisabledLoading Primary Secondary Signal Ghost Danger

Loading

Set aria-busy="true" while work runs. The button keeps its width, and the label stays readable to screen readers. Wrap the label in a span.

Sizes and icons

28, 36 and 44 pixels tall. Icon-only buttons need an aria-label.

Group

Keycap

Every shortcut is shown as a keycap, in text, inside buttons and in menus. Tools that have shortcuts show them here and nowhere else.

Press Ctrl V to paste an image

Tooltip

A short name for an icon button, shown on hover after a moment and on keyboard focus at once. Add data-tip. Never put anything in it that people need to read to use the tool.

Text field

Every field has a visible label. Hints say what people can't guess, like a limit or a format. Errors say what's wrong and how to fix it.

Shown under your name on the invoice
Use a width up to 8000 px

States

Default
Hover
Focus
Invalid
Read only
Disabled

With an icon, unit or button

KB

Text area

Select

The native select with the kit's border and chevron. The open list stays native, so it works with every keyboard and screen reader.

Checkbox and radio

Checkboxes pick any number of things. Radios pick one. The whole label is the click target.

Resize

States

OffHoverFocusOnMixedDisabled Checkbox Radio

Switch

For a setting that applies the moment it changes. If the change waits for a Save button, use a checkbox.

Segmented control

Two to five options where one is always on, like a format or a view. Built from radios, so arrow keys work.

Slider

Always show the current value next to the label. ui.js paints the filled part as the value changes.

82

Dropzone

The first thing most tools show. Click, drop or paste. It lights up while a file is dragged over it.

Card

A surface for one group of things. Head and foot are optional. A card that is a link gets a stronger border on hover and never moves.

Stage

Where a tool shows its result. The checkerboard shows transparency. The meta label holds the facts about the result, in mono.

512 × 512 · PNG · 4.1 KB

File row

One file in a list, with its size before and after, progress while it works and actions when it's done.

photo-0412.jpg 2.4 MB → 182 KB · −92%
team-offsite-wide.png 6.8 MB · compressing

Table

Numbers align right in mono. Rows are 44 pixels tall. A selected row takes the soft accent.

ItemQtyRateAmount
Landing page design1৳ 18,000৳ 18,000
Product photos, edited24৳ 450৳ 10,800
Hosting, 12 months1৳ 6,500৳ 6,500

Tag and status

Tags label a thing with a fact. A status dot only appears when it's bound to real, current state.

Draft Paid Due in 3 days Overdue Shared Bangla
Recording Synced Offline, saving locally Idle

Tabs

Switch between views of the same thing. Arrow keys move between tabs.

The rendered README, as GitHub shows it.

Accordion

Questions and answers at the bottom of a tool page. Native details, so it works without the script.

Are my files uploaded anywhere?
No. Everything runs in your browser and the files never leave your device.
Is there a size limit?
Up to 50 MB per image. Larger files may work but can be slow on phones.

Progress and loading

Show a bar with a value when you know how far along the work is. Without a value it travels. Spinners are for short waits inside a control. Skeletons hold the shape of content that is about to load.

Exporting MP440%
Loading model
Reading text

Notice

A message that stays on the page until the situation changes. For a message about something that just happened, use a toast.

The first run downloads a 40 MB model. After that it works offline.

Safari can't record system audio

Your microphone will still be recorded. Use Chrome or Edge to include sound from other tabs.

All 12 images are ready.

Toast

A short note about something that just happened. It leaves on its own and waits while hovered. Errors stay longer and can offer a way out.


mui.toast("Link copied")
mui.toast("photo-0412.jpg compressed to 182 KB", { tone: "ok" })
mui.toast("Upload failed. The file is over 50 MB", { tone: "bad", action: { label: "Try again", onClick: retry } })

Dialog

Only for a decision that has to happen before anything else. The native dialog traps focus and closes on Escape. The confirm button says what it does.

Delete this recording?

“Onboarding walkthrough” and its 3 exports will be removed from this browser. This can't be undone.

Empty state

Say what will appear here and give the one action that makes it appear.

No invoices yet

Invoices you make are saved in this browser and listed here.

App bar and footer

The same top and bottom on every tool, so people always know where they are. The mark is three ruler ticks. The tool name follows the slash.

mosaddik.devcompress