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.
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.
- 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
- 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.
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.
Motion
One curve, three durations. Motion explains a change and stops. Nothing loops unless work is really happening, and everything respects reduced motion.
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.
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.
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.
States
With an icon, unit or button
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.
States
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.
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.
File row
One file in a list, with its size before and after, progress while it works and actions when it's done.
Table
Numbers align right in mono. Rows are 44 pixels tall. A selected row takes the soft accent.
| Item | Qty | Rate | Amount |
|---|---|---|---|
| Landing page design | 1 | ৳ 18,000 | ৳ 18,000 |
| Product photos, edited | 24 | ৳ 450 | ৳ 10,800 |
| Hosting, 12 months | 1 | ৳ 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.
Tabs
Switch between views of the same thing. Arrow keys move between tabs.
The rendered README, as GitHub shows it.
The HTML source, ready to paste.
README.md, LICENSE and CONTRIBUTING.md.
Accordion
Questions and answers at the bottom of a tool page. Native details, so it works without the script.
Are my files uploaded anywhere?
Is there a size limit?
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.
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.
Your microphone will still be recorded. Use Chrome or Edge to include sound from other tabs.
This file isn't a valid PDF. Try exporting it again from the app that made it.
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.
Empty state
Say what will appear here and give the one action that makes it appear.
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.