Line icons: stroke width & four variants
Besides the layered and two-tone icons, the library comes in a line style: rounded strokes on a 24 grid, a stroke width you can set to any value above 0, four variants, and a hover motion that acts out what each icon means. It suits interface icons that sit next to text, at 16 to 32 pixels.
The icons play their motion in turn; an icon under the pointer holds its hover pose. To search, recolor, change the variant or the stroke width and copy them, choose Line in the icon browser.
Switch style by import path
A line icon has the same name as the layered one where the library has both, so switching style is one import. Each package has a line path:
// Layered
import { Lock, Camera } from "kubai-icons-react";
// Line
import { Lock, Camera } from "kubai-icons-react/line";
<Lock size={24} strokeWidth={2} variant="line-duo" />| Package | Line |
|---|---|
| React | kubai-icons-react/line |
| Vue | kubai-icons-vue/line |
| Svelte | kubai-icons-svelte/line |
| Solid | kubai-icons-solid/line |
| JavaScript | kubai-icons/line |
| Web component | <kubai-icon name="lock" icon-style="line" stroke-width="2"> |
| Static SVG | kubai-icons-static/svg-line/lock.svg |
Most line icons have a layered icon of the same name; a few exist only in this style. The full list is in kubai-icons/line/icons.json, where those few carry only: true.
In SwiftUI, the Swift package draws the line icons natively, with the same stroke widths and variants: KubaiLineIcon(.lock, strokeWidth: 1.5, variant: .lineDuo).
Stroke width
strokeWidth takes any width above 0, and defaults to 2; the browser on this site offers 0.25 to 3 and starts at 1.75. Match it to the weight of the text beside the icon: 1.5 for light text, 2 for regular, 2.25 for medium and 2.5 for bold. In Vue write :stroke-width, and on the web component stroke-width.
At 24 pixels and a width of 2, every edge falls on whole pixels. Outlines are placed by their outer edge, so an icon keeps its size at every width, and its small details move to keep their spacing. Widths from 1.5 to 2.5 are checked icon by icon; the rest are drawn from the nearest checked width.
Variants
variant | Looks like |
|---|---|
outline (default) | Lines in one color. |
line-duo | Inner and key parts in a light tone, under the lines in the full color. |
fill | Closed shapes filled, with details cut out of them. |
solid-tint | Lines in the full color over areas filled in a light tint, including areas that only look closed, such as the inside of a refresh arrow. |
One object always keeps one tone: the light tone of line-duo marks a whole part, such as the lens of a camera, never half of a shape.
Colors
A line icon uses up to three colors: the lines, a light tone and a fill tint. Which of them a variant shows:
variant | Lines & shapes | Light tone | Fill tint |
|---|---|---|---|
outline | Every line | – | – |
line-duo | The outer lines | Inner and key parts | – |
fill | Every shape, filled | – | – |
solid-tint | Every line | – | The areas inside |
There are four ways to set them, from the simplest:
- One color. Set
color, or leave it out and the icon takes the text color (currentColor). The lines use it; the light tone is it mixed 42% toward white and the tint 20%, so one color gives a matching set. - Mix toward your background. On a dark or colored background, set
--kl-bgto that background, and the light tone and the tint mix toward it instead of white. - Choose the tones.
--kl-lightsets the light tone ofline-duoand--kl-fillthe tint ofsolid-tint, for a brand accent beside neutral lines, for example. - Fixed colors in a file.
lineStill()writes a standalone SVG with the three colors written into it, for design tools and places without CSS.
.dark .kubai-line { --kl-bg: #0B0D14; }
.sidebar .kubai-line { --kl-light: #BDC8FA; --kl-fill: #E8ECFD; }The badgeColor prop of the layered icons doesn't apply. Files in svg-line/ are the outline variant at a width of 2, in currentColor.
Motion
Each icon plays its motion on hover, with the same trigger, hover and title props as the other styles. Where it can, the motion changes the icon's state: a lock's shackle lifts open, a bookmark ribbon grows down, a trash can's lid lifts and a slash draws across the icon it turns off. Some move parts in depth while the outline stays still: a globe's meridians turn round it, the pages of an open book turn over, a laptop's screen closes on its hinge; strokes keep their width throughout. With reduced motion turned on, icons stay still.
Drawing more
The line icons are drawn with the kubai-line skill, which follows the same grid, stroke and layout rules and checks each icon at every width before it joins the library. Icons you draw with it for your own product belong to you.
Questions
Can I mix the line style with the others?
Yes, but keep one style per area, such as line icons in a toolbar and layered icons on the marketing pages. Names are shared where both styles have the object, so moving an area from one style to another is one import.
Which stroke width should I use?
Start with 2 at 24 pixels. Use 1.5 next to light text or at 32 pixels and above, and 2.5 next to bold text or at 16 pixels, where thin lines fade.
Why is my icon not in the line set?
The line set covers common interface functions first. Use the layered or two-tone icon meanwhile, or draw it with the kubai-line skill.
Do line icons work without JavaScript?
Yes. The markup renders on the server at the chosen width and variant, and svg-line/ has a standalone file for each icon. Only the hover motion needs the script.