Getting Started
Installation
Add the UI package to an Angular app with the schematic, or install it manually when you want full control over each setup step.
Prerequisites
Components are composed from Tailwind utilities applied through nbClass. The library expects your app to have Tailwind CSS v4 configured and scanning your project source. The ng add schematic handles this automatically for Angular CLI apps.
Automatic setup
Use the schematic when you want the package, Tailwind CSS v4, PostCSS, and global style imports configured for you.
ng add @ng-brutalism/uiManual setup
Use manual setup when Tailwind is already managed by your app or when you want to review each change yourself.
npm install @ng-brutalism/ui
# or
pnpm add @ng-brutalism/uiStyles
For manual setup, import Tailwind and the bundled stylesheet once at your app's entry (e.g. src/styles.css). It includes the default theme tokens; import @ng-brutalism/ui/theme.css directly only when you need the token sheet by itself.
@import "tailwindcss";
@import '@ng-brutalism/ui/styles.css';Provider (optional)
The provider is only needed if you want to override theme tokens from Angular config. The simpler alternative is to redefine the CSS custom properties in your own stylesheet.
import { ApplicationConfig } from '@angular/core';
import { provideNgBrutalism } from '@ng-brutalism/ui';
export const appConfig: ApplicationConfig = {
providers: [
provideNgBrutalism({
theme: {
radius: '0px',
borderWidth: '3px',
},
}),
],
};Customization
Override these CSS variables on :root, a wrapper, or the component element. More local values win, so per-instance styling can sit directly on the element.
| Token | Default | Used for |
|---|---|---|
| --nb-border | #000000 | Border color and focus ring color |
| --nb-shadow | #000000 | Offset shadow color |
| --nb-radius | 0rem | Corner radius through the rounded-nb utility |
| --nb-shadow-offset-x | 4px | Horizontal shadow and press offset |
| --nb-shadow-offset-y | 4px | Vertical shadow and press offset |
| --nb-foreground | #000000 | Default foreground text color |
| --nb-background | #ffffff | Default surface background color |
| --nb-field-bg | #faf3d6 | Shared field background |
| --nb-primary | #ff90e8 | Primary accent color |
| --nb-primary-foreground | #000000 | Text on primary surfaces |
| --nb-secondary | #c8a2ff | Secondary accent color |
| --nb-secondary-foreground | #000000 | Text on secondary surfaces |
| --nb-accent | #8ae9ff | Accent color |
| --nb-accent-foreground | #000000 | Text on accent surfaces |
| --nb-danger | #ff4f8a | Danger states |
| --nb-danger-foreground | #000000 | Text on danger surfaces |
| --nb-success | #63e6be | Success states |
| --nb-success-foreground | #000000 | Text on success surfaces |
| --nb-warning | #ff9c42 | Warning states |
| --nb-warning-foreground | #000000 | Text on warning surfaces |
| --nb-main | oklch(90% 0.15 95) | Strong component fills |
| --nb-main-foreground | oklch(10% 0 0) | Text on main fills |
| --nb-surface | #ffffff | Component surface background |
| --nb-surface-foreground | #000000 | Text on component surfaces |
| --nb-secondary-background | oklch(96% 0 0) | Subtle secondary backgrounds |
| --nb-border-width | 2px | Border width token available to consumers |
| --nb-reverse-shadow-offset-x | -4px | Reverse shadow horizontal offset |
| --nb-reverse-shadow-offset-y | -4px | Reverse shadow vertical offset |
| --nb-size-sm | 2rem | Small size scale token |
| --nb-size-md | 2.5rem | Medium size scale token |
| --nb-size-lg | 3rem | Large size scale token |
| --nb-font-sans | system-ui, sans-serif | Default body font |
| --nb-font-mono | monospace | Monospace font token |
| --nb-font-weight-normal | 500 | Default body font weight |
| --nb-font-weight-bold | 700 | Bold component font weight |
| --nb-focus-ring | 3px solid var(--nb-foreground) | Focus outline utility |
| --nb-focus-ring-offset | 2px | Focus outline offset |
Usage
import { Component } from '@angular/core';
import { NbButton } from '@ng-brutalism/ui';
@Component({
selector: 'app-example',
imports: [NbButton],
template: `<button nbButton variant="neutral" style="--nb-button-bg: #fff">Ship it</button>`,
})
export class Example {}