Overview
Helper classes are six CSS classes for the markup you write yourself: a wrapper, a custom panel, a line of text. Each class does one thing. nds-center centers, and nds-flush removes spacing, nds-flush-inline and nds-flush-block remove only the side or the top and bottom padding. nds-color-primary sets the brand text color. nds-note makes a small line of secondary text.
Pick another component when:
- the items sit in a row or a column: Flex
- the items sit in columns that change with the screen width: Grid
- the element hides at one screen size: Hidden
- long text stops after a number of lines: Truncate Text
- the message needs an icon, a box or a close button: Feedback Icons or Alert
Markup
رقم الطلب REQ-2026-4417، وسيصلك رد خلال يومي عمل.
للاستفسار اتصل على +966 11 456 7890
احتفظ برقم الطلب لمتابعة حالته.
Variants
The canon is a request confirmation on an Arabic page. Each Class chip adds its class where this screen needs it, and any mix can be on. Rows that share an Option are one choice: write the class on each element. Note Status applies to the note.
| Group | Option | Markup | On element | Use |
|---|---|---|---|---|
| Class (any) | Center | .nds-center |
#helpers-card |
Centers the text in an element and everything inside it. On a card it centers the content, not the card |
| Class (any) | Flush (hint: Removes padding, margin, border and corner radius) (limit: 1 flush) | .nds-flush |
#helpers-card |
Removes a component’s own padding, margin, border and corner radius when the frame around it gives them. Here the card loses its border and padding, and a card also loses its fill and shadow, so its content sits straight on the page |
| Class (any) | Flush sides (hint: Removes only the padding at the start and the end) (limit: 1 flush) | .nds-flush-inline |
#helpers-card |
Removes only the padding at the start and the end, so the content lines up with the edge around it. On Tabs, write it on each panel |
| Class (any) | Flush top and bottom (hint: Removes only the padding above and below) (limit: 1 flush) | .nds-flush-block |
#helpers-card |
Removes only the padding above and below. |
| Class (any) | Brand Color | .nds-color-primary |
#helpers-number |
Text that is not a link, in the brand text color: a figure, a term, a status word |
| Note Status | None (default) | — | — | Secondary text color |
| Note Status | Error | [data-status="error"] |
.nds-note |
The required-fields line above a form, or a note about a cost or a limit |
| Note Status | Warning | [data-status="warning"] |
.nds-note |
A note the user must read before they continue |
| Note Status | Success | [data-status="success"] |
.nds-note |
A note that confirms a condition is met |
| Note Status | Info | [data-status="info"] |
.nds-note |
A neutral fact the user may want |
Built-in Features
-
One Centering Class
nds-centerworks on your markup and on components. A card centers its content, a flex or a grid centers its items, and a section centers its head. -
Priority Over Component Styles
nds-center,nds-flush,nds-flush-inlineandnds-flush-blockuse!important, so they apply on any element, even one a component styles, with no extra selector. -
Palette Colors
Brand text and the four note statuses read the text color tokens, so a custom palette changes them with the rest of the page.
-
Note in Any Place
A note sets only its color and text size, with no margin. It fits in a label or a legend as a hint, or stands alone as a paragraph.
-
CSS Only
Every helper class is CSS only. There is nothing to initialize.
Best Practices
- Use a component’s own options first. Use a helper class where no option does what you need.
- Put one
nds-centeron a wrapper, not on every child. Text alignment inherits. nds-centercenters the element itself only when it is narrower than its parent, such as an element with amax-width.- A card with
nds-centercenters its content, not the card. To center the card, center its container:nds-flex nds-center. - On a right-to-left page, write
dir="ltr"on aspanaround a left-to-right value, neverdir="ltr"ordir="auto"on the element that holds it, such as a table cell or row, add, a list item, a paragraph or a field: there it moves the value to the left edge, out of line with the rest of the page. NDS email, phone, URL and formatted fields already read left to right on the right side, so they take nodir. Inside a right-to-left sentence, wrap every left-to-right value. Alone in a cell or a detail value, wrap only a value the page would reorder: one that starts or ends with a sign or mark (+966…,-5, a trailing/), digits in groups (050 123 4567), or a time with AM or PM. An email, a URL, an IBAN, a code, a date or a plain number needs nothing. For right-to-left text in a left-to-right page, writedir="rtl"andlang. Browsers, screen readers and translation tools read the attributes, so NDS has no class for direction. - Do not use
nds-flushfor small spacing changes. It clears four properties with!important, so a later change is harder. Set the component’s own custom property instead. - Do not build a layout from these classes. Use Flex or Grid.
- There are no margin or padding classes. Set
--gapon the flex or grid that holds the items, or use a spacing token in your own CSS. - For a note under a table or a form, put
nds-blockon the element above it. The block’s gap separates them. - Keep a required-fields note to one line above the first field.
data-requiredon each field container marks the field. - Links are primary already. Use
nds-color-primaryonly on text that is not a link.
API
Classes
| Class | Element | Effect |
|---|---|---|
nds-center |
Any element | Centers the text with !important, and sets margin-inline: auto |
nds-flush |
Any element | Sets padding, margin, border and corner radius to 0, with !important |
nds-flush-inline |
Any element | Sets the start and end padding to 0, with !important. |
nds-flush-block |
Any element | Sets the top and bottom padding to 0, with !important. |
nds-color-primary |
Any element | Sets the brand text color, --text-primary |
nds-note |
A text element | Small text in the secondary paragraph color. No margin |
Data Attributes
| Attribute | Element | Effect |
|---|---|---|
data-status |
.nds-note |
Sets the note color: error, warning, success or info. Set it yourself |