ng-hub-ui-ds

ng-hub-ui ファミリーが共有するデザイントークンの土台です。CSS 変数 --hub-ref-*(プリミティブ)と --hub-sys-*(セマンティック)を、ライト/ダークと 8 つのテーマとともに提供します。一度読み込めば、ファミリー全体が同じパレットを読みます。

これは何で、何のためのものか

役割は、ファミリーすべてのライブラリにまたがるスタイル変数をそろえ、つなぐことです。各ライブラリは --hub-* 変数でテーマ付けされますが、それを定義はしません。消費するだけです。このパッケージはそれらを結ぶ唯一の真実の源であり、その結果:

  • ひとつのパレットが panels、forms、calendar、board… を同時に養います。
  • テーマ変更は一度だけ(トークンひとつ)で、変更がファミリー全体に届きます。
  • ダークモードと 8 テーマが用意され、属性ひとつで切り替わります。
  • 自分の CSS でも使えるので、あなたの UI がコンポーネントとそろいます。

接続はライブラリ単位で進めています。下のファミリーに、それぞれの統合状況があります。トークンの全一覧をお探しですか。トークンリファレンスにあります。

はじめに

全体の道筋です。何をインストールし、何をどこに読み込み、どの変更にどの仕組みを使うか。ds は依存関係がなく(純粋な CSS/SCSS)、読み込まないかぎり何も出力しません。

1 · インストール

ds が土台です。使うファミリーのライブラリを足してください。どれもパレットを定義せず、すべて ds のトークンを消費します。

npm install ng-hub-ui-ds
npm install ng-hub-ui-panels ng-hub-ui-forms …   # the ones you use

2 · 読み込み — ルートで一度だけ、この順序で

/* styles.scss (application root) */

/* 1 · Tokens — ALWAYS, exactly once: the base the whole family consumes */
@use 'ng-hub-ui-ds/styles/tokens/hub-tokens';

/* 2 · Native-element reset — only if your app does not ship one already (Bootstrap Reboot…) */
@use 'ng-hub-ui-ds/styles/base/reset';

/* 3 · Utilities — opt-in: import only the sheets you use
      (Bootstrap-exact names: do NOT load them next to a global Bootstrap) */
@use 'ng-hub-ui-ds/styles/utilities/layout';
@use 'ng-hub-ui-ds/styles/utilities/text';
@use 'ng-hub-ui-ds/styles/utilities/surfaces';

/* 4 · Sheets of their own shipped by some libraries — once, path documented by each README */
@use 'ng-hub-ui-forms/styles' as hub-forms;  // shared forms chrome
@use 'ng-hub-ui-utils/styles/tooltip';       // utils tooltip

/* 5 · Mixins — when you build your own components with the same system */
@use 'ng-hub-ui-ds' as hub;
.page { @include hub.center($max: xl); }

Sass なしでも動きます。各シートにはコンパイル済みの .css があります — @import 'ng-hub-ui-ds/styles/tokens/hub-tokens.css'; — あるいは angular.json 経由で:

"styles": [
  "node_modules/ng-hub-ui-ds/styles/tokens/hub-tokens.css",
  "src/styles.scss"
]

3 · 変更する — 変えたい内容ごとの仕組み

やりたいこと仕組み説明のある場所
グローバルな色を変える(たとえば primary):root { --hub-sys-color-primary: … } — ファミリー全体のテーマが変わります変更のしかた
新しいアクセントを足す(brand、tertiary…)CSS: --hub-sys-color-brand · Sass: $hub-accents-extra変更のしかた
使わないバリアントを外すSass: マップを置き換えます — with ($hub-accents: (primary: …, danger: …)) — そのファミリーだけが出力されますSCSS 関数
spacing / 角丸 / グリッドを調整する構造トークン --hub-ref-space-* / --hub-sys-radius-* / --hub-sys-grid-* を上書きします構造レイヤー
テーマまるごと(dark、corporate…)[data-theme='…'] { 異なるトークン } と <html> の属性テーマを作る
同じ仕組みで自分のコンポーネントを作るミックスイン: @include hub.stack() · hub.text-bg(brand) · hub.radius(lg)… — またはユーティリティクラスミックスインとスタイル
Bootstrap / Material / Tailwind と共存するブリッジ用ミックスイン: @include hub.bridge-bootstrap($mode: adopt | project)ブリッジ
あるライブラリのあるコンポーネントだけ微調整するそのコンポーネント固有のフック --hub-<component>-*(スコープ付きでもグローバルでも)トークンリファレンスと各ライブラリのページ

4 · そして残りのライブラリ

トークンを読み込めば、ほかに設定するものはありません。どの ng-hub-ui-* も --hub-sys-* を読み、あなたの上書きに合わせて自分でテーマを組み替えます。さらに各コンポーネントは微調整用の --hub-<component>-* フックを公開し、いくつかのライブラリはトークンの隣で一度だけ読み込む独自のシートを持ちます — 正確なパスは各 README が記しています(たとえば forms の共通クロームや utils のツールチップ/オーバーレイ。手順 2 のブロックにあるとおりです)。各ライブラリの統合状況はファミリーにあります。

アーキテクチャ: 2 つのレイヤー

ref

--hub-ref-*

文脈を持たない生の値。カラーランプ、余白、角丸、タイポグラフィ。

--hub-ref-color-blue-500
sys

--hub-sys-*

意味を担う割り当て。コンポーネントが消費するのはこちらです。

--hub-sys-color-primary

原則: コンポーネントが参照するのは sys トークンだけで、sys は ref を指します。sys を変えるとテーマが変わり、ref を変えると基本パレットが動きます。

セマンティックカラー · テーマの実演

セットは開かれています。既定で 9 バリアント(有彩 5 + 中間色 4)、それにあなたが足したもの。どのアクセントも同じ形のロール一式を公開します — subtle、border-subtle、emphasis、そしてコントラスト用の on。テーマを切り替えて、パレット全体が塗り替わる様子をご覧ください。

primary
base
subtle
border
emphasis
on
secondary
base
subtle
border
emphasis
on
success
base
subtle
border
emphasis
on
danger
base
subtle
border
emphasis
on
warning
base
subtle
border
emphasis
on
info
base
subtle
border
emphasis
on
neutral
base
subtle
border
emphasis
on
light
base
subtle
border
emphasis
on
dark
base
subtle
border
emphasis
on
通知 primary
通知 secondary
通知 success
通知 danger
通知 warning
通知 info
通知 neutral
通知 light
通知 dark

テーマを作る · 変えるのはベースの色だけ

各セマンティックファミリーのベースの色だけを定義します。残り(subtle、border-subtle、emphasis、on)は color-mix / relative color で自動的に導出されます。下のコンポーネントがその場で色を変えるのが、共有された配線そのものです。

primary ベース → 導出
base
subtle
border
emphasis
on
secondary ベース → 導出
base
subtle
border
emphasis
on
success ベース → 導出
base
subtle
border
emphasis
on
danger ベース → 導出
base
subtle
border
emphasis
on
warning ベース → 導出
base
subtle
border
emphasis
on
info ベース → 導出
base
subtle
border
emphasis
on
neutral ベース → 導出
base
subtle
border
emphasis
on
light ベース → 導出
base
subtle
border
emphasis
on
dark ベース → 導出
base
subtle
border
emphasis
on

コンポーネントの実演

通知 primary
通知 secondary
通知 success
通知 danger
通知 warning
通知 info
通知 neutral
通知 light
通知 dark
primarysecondarysuccessdangerwarninginfoneutrallightdark
.my-theme {
  /* define ONLY the base colour of each family */
  --hub-sys-color-primary: #6d28d9;

  /* the rest derives at runtime with color-mix / relative color — nothing to maintain */
  --hub-sys-color-primary-subtle:        color-mix(in oklch, var(--hub-sys-color-primary) 12%, var(--hub-sys-surface-page));
  --hub-sys-color-primary-border-subtle: color-mix(in oklch, var(--hub-sys-color-primary) 35%, var(--hub-sys-surface-page));
  --hub-sys-color-primary-emphasis:      color-mix(in oklch, var(--hub-sys-color-primary) 80%, var(--hub-sys-color-ink));
  --hub-sys-color-primary-on:            oklch(from var(--hub-sys-color-primary) clamp(0, (0.62 - l) * 1000, 1) 0 h);
}

ファミリー · 統合状況

ファミリー全体がこれらのトークンを読みます。バッジは、そのライブラリがすでに --hub-sys-* に接続済みか(デザインシステムと一緒にテーマが変わります)、まだ未対応か(あとで着手します)を示します。どれかを押すと、その例が見られます。

変更のしかた

1. トークンを上書きする(CSS)— 主な道

どの値も CSS 変数なので、テーマの変更は 1 行で済み、ファミリー全体にカスケードします。

:root {
  --hub-sys-color-primary: #7c3aed;
  --hub-sys-color-primary-subtle: #ede9fe;
  --hub-sys-color-primary-emphasis: #5b21b6;
}

2. 自分のアクセントを足す

--hub-sys-color-<name> のファミリーを定義すると、セマンティックバリアントを受け取るコンポーネントがそのまま拾います。ここで試せます:

brand の通知 — 背景・文字・境界を color-mix でアクセントから導出しています。
:root {
  --hub-sys-color-brand: #9333ea;
  --hub-sys-color-brand-subtle: #f3e8ff;
  --hub-sys-color-brand-border-subtle: #d8b4fe;
  --hub-sys-color-brand-emphasis: #6b21a8;
}

<!-- in any component that accepts a semantic variant -->
<hub-panel appearance="alert" variant="brand">Brand alert</hub-panel>

--hub-sys-color-brand だけでも動きます(残りはコンポーネントが color-mix で導出します)。正確な色味がほしいときにファミリーを全部定義してください。

… または開かれたマップに先に書く(Sass)

Sass を使うなら、パッケージを取り込む前に $hub-accents-extra で開かれたアクセントマップを広げます。再コンパイルされるのは ds だけで、ライブラリは一切再コンパイルされません。新しいバリアントはそれぞれ完全なファミリー(subtle · border-subtle · emphasis · on)を得ます:

// Add your own variants — this recompiles the ds only, never the libraries.
@use 'ng-hub-ui-ds/styles/tokens/hub-tokens' with (
  $hub-accents-extra: (
    brand:    #ff6b00,
    accent:   #00b8d9,
    tertiary: #9c36b5
  )
);
// brand · accent · tertiary get subtle · border-subtle · emphasis · on automatically.

3. 自分のテーマを作る

[data-theme='corporate'] {
  --hub-sys-color-primary: #0033a0;
  --hub-sys-surface-page: #fbfcff;
  --hub-sys-text-primary: #0a1f44;
  /* …the rest of the tokens that differ from the base */
}

4. …あるいは hub.theme() でまとめて(Sass)

部分的なテーマ設定のためのミックスインひとつ。変更点だけをマップで渡せば、正規の名前で変数を出力します。各トークンにぶら下がるもの — sys エイリアス、ロールのファミリー、ユーティリティ、コンポーネント — は var() の連鎖で勝手に導出し直されます:

@use 'ng-hub-ui-ds' as hub;

/* change ONLY spacing step 3 — gap-3, .p-3, sys-gap-3, components… all move with it */
:root { @include hub.theme($space: (3: 1.25rem)); }

/* or a whole theme, scopeable to [data-theme] or to a subtree */
[data-theme='compact'] {
  @include hub.theme(
    $space: (3: 0.75rem, 4: 1rem),
    $radius: (md: 0.25rem),
    $accents: (primary: #0f766e, brand: #ff6b00)
  );
}

SCSS 関数: 内部でどう生成しているか

セマンティックなカラーファミリーは手書きしていません。アクセントの集合は !default 付きの開かれたマップで、ファミリーは map.keys($hub-accents) に対する @each で導出されます。だから色を 1 つ(あるいは 9 つ)足す作業は一様で、定型コードがありません。マップのどのキーも自動的に自分のファミリーを得ます。

// The accent set is an OPEN map with !default — add as many as you want.
$hub-accents: (
  primary: …, secondary: …, success: …, danger: …, warning: …,
  info: …, neutral: …, light: …, dark: …
) !default;

// The family is derived ONCE in :root, iterating EVERY key of the map,
// so any accent you add gets its family for free.
@mixin hub-color-derive() {
  @each $name in map.keys($hub-accents) {
    --hub-sys-color-#{$name}-subtle:   color-mix(in oklch, var(--hub-sys-color-#{$name}) 12%, var(--hub-sys-surface-page));
    --hub-sys-color-#{$name}-emphasis: color-mix(in oklch, var(--hub-sys-color-#{$name}) 80%, var(--hub-sys-color-ink));
    --hub-sys-color-#{$name}-on:       oklch(from var(--hub-sys-color-#{$name}) clamp(0, (0.62 - l) * 1000, 1) 0 h);
  }
}

多くの場合、SCSS に触れる必要はありません。CSS 変数の上書きだけで、テーマの変更もアクセントの追加もまかなえます。マップとミックスインは内部の仕組みで、パッケージに貢献するときに役立ちます。

構造レイヤー · トークンの実演

色に加えて、ds は正規の構造レイヤーも定義します。spacing のスケール(--hub-ref-space-*)、サイズと分数(--hub-sys-size-*)、グリッド(--hub-sys-grid-columns、ガター)、そしてセマンティックな gap のスケール(--hub-sys-gap-*)です。以下はすべてこれらの変数を消費して描かれています。

spacing のスケール · --hub-ref-space-0…7

space-0
space-1
space-2
space-3
space-4
space-5
space-6
space-7

gap のスケール · --hub-sys-gap-0…5

gap-0
ABC
gap-1
ABC
gap-2
ABC
gap-3
ABC
gap-4
ABC
gap-5
ABC

幅の分数 · --hub-sys-size-*

size-1-21/2
size-1-31/3
size-2-32/3
size-1-41/4
size-3-43/4
size-fullfull

グリッド auto-fit + コンテナ幅

col 1col 2col 3col 4col 5col 6
max-sm
max-md
max-lg
max-xl
max-xxl
/* Canonical structural tokens (ref → sys) */
gap: var(--hub-sys-gap-3);                  /* spacing scale */
padding-inline: var(--hub-ref-space-4);
max-width: var(--hub-sys-container-max-width-lg);
grid-template-columns: repeat(var(--hub-sys-grid-columns), minmax(0, 1fr));

/* Layout mixins */
@use 'ng-hub-ui-ds' as hub;
.page    { @include hub.center($max: xl); }
.toolbar { @include hub.cluster($gap: 2); }
.cards   { @include hub.grid($min: 16rem, $gap: 3); }

/* Opt-in utilities (Bootstrap naming, 3 sheets) */
@use 'ng-hub-ui-ds/styles/utilities/layout';    // .d-flex .gap-3 .ms-auto .position-* .ratio-*
@use 'ng-hub-ui-ds/styles/utilities/text';      // .fs-3 .fw-bold .text-truncate .text-muted
@use 'ng-hub-ui-ds/styles/utilities/surfaces';  // .bg-* .border .rounded .shadow .opacity-*

ミックスインとスタイル

ds の Sass API です。正規のトークンを消費するヘルパーで、spacing も色も焼き込みません。@use 'ng-hub-ui-ds' as hub と名前空間付きで読み込みます。ユーティリティのシートも同じミックスインから作られているので、挙動を変えたり広げたりすることは、そのミックスインで自分のクラスを作ることと同じです。以下のデモはすべて実際のミックスインから組まれています。全一覧は最後にあります。

どのミックスインにも対応するユーティリティがあります。以下のデモは ds の実クラス(.cluster、.stack…)を使っており、このページでミックスインを当て直してはいません。

hub.cluster() · .cluster — 折り返す行

ホーム製品料金お問い合わせその他

hub.stack() · .stack — 列

ブロック 1ブロック 2ブロック 3

hub.grid() · .grid-auto — auto-fit グリッド

12345678

hub.center() · .center — 中央寄せのラッパー

中央寄せの内容(max-width xl)
@use 'ng-hub-ui-ds' as hub;

.toolbar { @include hub.cluster($gap: 2); }          // a row that wraps
.feed    { @include hub.stack($gap: 3); }            // a column
.cards   { @include hub.grid($min: 8rem, $gap: 2); } // auto-fit grid
.page    { @include hub.center($max: sm); }          // centred wrapper

全一覧

ミックスイン引数説明
テーマ
hub.theme()$accents, $space, $gap, $radius, $shadow, $font-*, $line-height, $tokens一度の呼び出しで部分的にテーマを設定します。変更点だけをマップで渡すと正規の変数を出力し、そこから導かれるものは自動で導出し直されます。
ブレークポイント
hub.media-breakpoint-up()$name, $breakpoints: $hub-breakpointsそのブレークポイント以上のモバイルファースト・メディアクエリ(sm 576 · md 768 · lg 992 · xl 1200 · xxl 1400)。
hub.media-breakpoint-down()$name, $breakpoints: $hub-breakpointsそのブレークポイント未満のメディアクエリ。
レイアウト
hub.stack()$gap: 3, $align: stretchトークンの gap を持つ flex の列。
hub.cluster()$gap: 2, $align: center, $justify: flex-start折り返す flex の行。
hub.grid()$min: 16rem, $gap: 4セルの最小幅を指定する auto-fit グリッド。
hub.grid-fixed()$cols: 12, $gap: 4N 列固定のグリッド。
hub.row()$gap: 312 トラックの行(--hub-sys-grid-columns)。
hub.col()$span: 12row() の $span 個のトラックにまたがるセル。
hub.offset()$n: 0col() を $n + 1 番目のトラックから始めます(Bootstrap の offset)。0 で解除。
hub.center()$max: xl, $pad: 3コンテナの max-width に中央寄せするラッパー。
タイポグラフィ
hub.font-family()$family: basebase | display | mono。
hub.font-size()$size: base1–6(見出しのスケール)または xs | sm | base | lg。
hub.font-weight()$weight: baselight | base | medium | semibold | bold。
hub.line-height()$height: base1 | sm | base | lg。
hub.text-color()$variant: body開かれたマップのアクセント、body、または muted。--hub-text-opacity で薄くできます。
hub.link-color()$variant: primaryアクセントのリンク。ホバーで -emphasis、下線には不透明度(--hub-link-underline-opacity)。
hub.text-truncate()—1 行で三点リーダー省略。
hub.text-break()—長い単語や URL をはみ出さずに折り返します。
サーフェス
hub.bg()$variant: body, $subtle: falseアクセントの背景(またはその subtle の色味)、body、transparent。--hub-bg-opacity で薄くできます。
hub.text-bg()$variant: primaryアクセントの背景 + コントラストを保証する -on の文字色。
hub.border()$width: 1px, $color: …既定の境界トークンによる実線の境界。
hub.border-color()$variant: primary開かれたマップのアクセントから取る境界色。
hub.radius()$size: mdnone | sm | md | lg | xl | xxl | pill | circle。
hub.shadow()$size: mdnone | sm | md | lg | inset。
ヘルパー
hub.focus-ring()—--hub-sys-focus-ring-* のトークンを使うフォーカスリング。
hub.visually-hidden()—視覚的に隠しつつ、スクリーンリーダーからは読めるままにします。
hub.stretched-link()—リンクのクリック領域を、位置指定された祖先まで広げます。
hub.ratio()$x: 16, $y: 9ネイティブの aspect-ratio による固定比率。
hub.clearfix()—float を解除します(::after)。
ブリッジ
hub.bridge-bootstrap()$mode: adopt | project--bs-* のテーマを取り込む、またはそこへ投影します。
hub.bridge-material()$mode: adopt | project--mat-sys-* でも同様(Angular Material 3)。
hub.bridge-tailwind()$mode: adopt | project--color-* でも同様(Tailwind v4 @theme)。
hub.bridge-open-props()$mode: adoptOpen Props のランプのエイリアス。

ユーティリティ

同じレイヤーを包む任意導入のクラスで、名前は Bootstrap とまったく同じです。差し替えとして使えますが、同じドキュメントでこれらのシートとグローバルな Bootstrap を両方読み込まないでください。シートは 3 つ。layout(display/flex、grid、spacing、sizing、position、helpers — これらの節)、text(「テキスト」の節)、surfaces(「サーフェス」の節)です。デモは実クラスを使っています:

.cluster .gap-2

いちにさんよん

.grid-auto .gap-2

ABCDEF

サイズ · .w-50 · .w-25 · .w-auto

w-50w-25w-auto
// three opt-in sheets — import only the ones you use
@use 'ng-hub-ui-ds/styles/utilities/layout';    // layout, spacing, position, helpers
@use 'ng-hub-ui-ds/styles/utilities/text';      // typography and text
@use 'ng-hub-ui-ds/styles/utilities/surfaces';  // backgrounds, borders, radii, shadows

<div class="cluster gap-2"> … </div>
<div class="grid-auto gap-2"> … </div>
<div class="w-50">half</div>
<div class="vh-100 min-vh-100">viewport height</div>

Flexbox

display と flexbox のユーティリティ一式を、Bootstrap とまったく同じ命名で用意しています。デモは ds の実クラスを使っています。

justify-content · .justify-content-* — 主軸

.justify-content-start
ABC
.justify-content-end
ABC
.justify-content-center
ABC
.justify-content-between
ABC
.justify-content-around
ABC
.justify-content-evenly
ABC

align-items · .align-items-* — 交差軸

.align-items-start
smmdlg
.align-items-center
smmdlg
.align-items-end
smmdlg
.align-items-stretch
smmdlg
.align-items-baseline
smmdlg

flex-direction · .flex-column

行 1行 2行 3

flex-fill / flex-grow-0 — 伸ばす・固定する

.flex-fill(伸びます).flex-grow-0

レスポンシブ · .flex-md-row · .align-items-md-center

flex 系はすべてブレークポイントごとのバリアントを持ちます。モバイルでは列、md 以上では中央寄せの行 — ウィンドウの幅を変えてみてください:

いちにさん

縦の区切り · .vr

左右
<!-- display + direction / wrap -->
<div class="d-flex flex-wrap gap-2"> … </div>
<div class="d-flex flex-column"> … </div>

<!-- main axis (justify) and cross axis (align) -->
<div class="d-flex justify-content-between align-items-center"> … </div>

<!-- grow / pin -->
<div class="d-flex gap-2">
  <span class="flex-fill">grows</span>
  <span class="flex-grow-0">fixed</span>
</div>

<!-- responsive: a column on mobile, a top-aligned row from md up -->
<div class="d-flex flex-column flex-md-row align-items-md-start"> … </div>

<!-- vertical divider -->
<div class="d-flex gap-3">left <span class="vr"></span> right</div>

カラム、幅、spacing

12 カラムのグリッド(.row + .col-1…12 + .offset-1…11、--hub-sys-grid-columns が駆動)と、幅、そして方向つきの padding/margin。どのデモも実際のユーティリティを使っています。

カラム · .row + .col-N

col-6
col-6
col-4
col-4
col-4
col-3
col-3
col-6
col-8
col-4
col-12
col-2
col-2
col-2
col-2
col-2
col-2

オフセット · .offset-N

セルは同じグリッドの n + 1 番目のトラックから始まります(grid-column-start)。ブレークポイント付きなら .offset-md-8、.offset-md-0 で自動配置に戻ります。

col-4 offset-4
col-3 offset-9

幅 · .w-25 / 50 / 75 / 100 / auto

w-25w-25
w-50w-50
w-75w-75
w-100w-100
w-autow-auto

Padding · .p-1…5(四辺)

p-1
p-2
p-3
p-4
p-5

軸ごとの padding · .px-* / .py-*

px-4 · py-1
px-2 · py-4
px-5 · py-3

Margin · .m-1…5(基準となる枠の中で)

m-1
m-2
m-3
m-4
m-5

軸ごとの margin · .mx-* / .my-*

mx-4
my-3

レスポンシブ · .col-md-6 · .d-lg-none · .p-sm-3

モバイルファーストのバリアント(sm 576 · md 768 · lg 992 · xl 1200 · xxl 1400)が、display、カラムとオフセット、spacing、gap、そして flex 系すべて(.flex-md-row、.justify-content-md-center、.align-items-md-start、.order-lg-*…)にあります。ウィンドウの幅を変えてみてください — これらのセルは .col-12 .col-md-6 .col-xl-3 です:

col-12 · md-6 · xl-3
col-12 · md-6 · xl-3
col-12 · md-6 · xl-3
col-12 · md-6 · xl-3
<!-- mobile-first: 1 column → 2 at ≥768px → 4 at ≥1200px -->
<div class="row">
  <div class="col-12 col-md-6 col-xl-3">…</div>
</div>
<div class="d-none d-lg-flex">desktop only</div>
<section class="p-2 p-md-4">padding that grows with the viewport</section>

// breakpoints as a mixin — for any other utility or your own CSS
@use 'ng-hub-ui-ds' as hub;
@include hub.media-breakpoint-up(md) { .sidebar { width: 18rem; } }
<!-- 12-column grid: every row adds up to 12 -->
<div class="row">
  <div class="col-6">col-6</div>
  <div class="col-6">col-6</div>
</div>
<div class="row">
  <div class="col-4">col-4</div>
  <div class="col-4">col-4</div>
  <div class="col-4">col-4</div>
</div>

<!-- offset: .col-4.offset-8 starts on track 9 (offset-{bp}-0 resets it) -->
<div class="row">
  <div class="col-4 offset-md-8">col-4 offset-md-8</div>
</div>

<!-- widths · directional padding and margin -->
<div class="w-50">w-50</div>
<div class="p-3">1rem of padding on all four sides</div>
<div class="px-4 py-2">padding-inline 1.5rem · padding-block .5rem</div>
<div class="mx-3">margin-inline 1rem</div>

テキスト

タイポグラフィとテキストのユーティリティを Bootstrap とまったく同じ命名で、タイポグラフィのミックスイン(hub.font-size()、hub.font-weight()、hub.text-color()…)の上に組んでいます。どの値もトークンへ解決されるので、トークンを上書きすればユーティリティのテーマも変わります。ミックスインを使えば自分のバリアントも作れます。

サイズ · .fs-1…6 · 見出し · .h1…6

.fs-1見出しの例
.fs-2見出しの例
.fs-3見出しの例
.fs-4見出しの例
.fs-5見出しの例
.fs-6見出しの例

.fs-* はサイズだけを変えます。.h1…6 は見出しのタイポグラフィ一式(サイズ + 太字 + 詰まった行間 + 余白)をセマンティクス抜きで当てます — <div class="h5"> が <h5> のように見えます:

.h1
見出しの例
.h2
見出しの例
.h3
見出しの例
.h4
見出しの例
.h5
見出しの例
.h6
見出しの例

ウェイト · .fw-* · スタイル · .fst-italic

.fw-lightウェイトはトークン由来です — light
.fw-normalウェイトはトークン由来です — normal
.fw-mediumウェイトはトークン由来です — medium
.fw-semiboldウェイトはトークン由来です — semibold
.fw-boldウェイトはトークン由来です — bold
.fst-italic斜体

揃え · .text-start / .text-center / .text-end

.text-start
.text-center
.text-end

Transform · 装飾 · ファミリー

.text-uppercase.text-capitalize.text-decoration-underline.text-decoration-line-through.font-monospace

等幅数字 · .font-tabular-nums

プロポーショナルの数字は桁ごとに幅が違うため、1 は 0 より細く、2 つの金額の一の位がずれた場所に来ます。金額の列は上下に見比べて読むものです。左右で小数点がどこに来るか見てください。

既定
1.111,11 €
9.087,70 €
11,10 €
777.777,77 €
.font-tabular-nums
1.111,11 €
9.087,70 €
11,10 €
777.777,77 €

省略 · .text-truncate

16rem に収まらず、三点リーダーで省略されるだけの長さを持たせた文章です。

行間 · .lh-1 / .lh-sm / .lh-base / .lh-lg

.lh-1スケールの各段が与える行間を確かめられるだけの、2 行分のテキストです。
.lh-smスケールの各段が与える行間を確かめられるだけの、2 行分のテキストです。
.lh-baseスケールの各段が与える行間を確かめられるだけの、2 行分のテキストです。
.lh-lgスケールの各段が与える行間を確かめられるだけの、2 行分のテキストです。

色 · .text-primary … .text-muted

primarysecondarysuccessdangerwarninginfoneutrallightdarkbodymuted

文字の不透明度 · .text-opacity-* · リンク · .link-*

255075100
// import the sheet once
@use 'ng-hub-ui-ds/styles/utilities/text';

<h2 class="fs-3 fw-semibold">Headline</h2>
<p class="text-muted lh-lg">Secondary copy with generous leading</p>
<span class="text-uppercase fw-medium">label</span>
<td class="text-end font-monospace">1.234,56 €</td>
<p class="text-truncate" style="max-width: 16rem">Truncated with an ellipsis…</p>

// …or mint variants of your own with the mixins
@use 'ng-hub-ui-ds' as hub;
.card__title { @include hub.font-size(4); @include hub.font-weight(semibold); }
.card__meta  { @include hub.text-color(muted); @include hub.text-truncate(); }

サーフェス

背景、境界、角丸、影、不透明度を Bootstrap とまったく同じ命名で、サーフェスのミックスイン(hub.bg()、hub.text-bg()、hub.radius()、hub.shadow()…)と --hub-sys-color-* / --hub-sys-radius-* / --hub-sys-shadow-* のトークンの上に組んでいます。

背景 · .bg-* と .bg-*-subtle

背景 + コントラスト保証 · .text-bg-*

primarysecondarysuccessdangerwarninginfoneutrallightdark

境界 · .border · .border-{variant} · .border-1…5

borderprimarydanger · 3上下なし

角丸 · .rounded-0…3 · .rounded-pill · .rounded-circle

012345pill1:1

影 · .shadow-sm / .shadow / .shadow-lg

smmdlg

不透明度 · .opacity-*(要素)· .bg-opacity-*(背景のみ)

255075100
bg-10bg-25bg-50bg-75bg-100
// import the sheet once
@use 'ng-hub-ui-ds/styles/utilities/surfaces';

<hub-badge color="success">active</hub-badge>
<div class="bg-warning-subtle border border-warning rounded-3 p-3">notice</div>
<div class="bg-body rounded shadow-lg p-4">raised card</div>

// …or mint variants of your own with the mixins
@use 'ng-hub-ui-ds' as hub;
.card        { @include hub.bg(body); @include hub.radius(lg); @include hub.shadow(sm); }
.card--brand { @include hub.text-bg(brand); }  // any accent of the open map

配置とヘルパー

position/inset、overflow、order、float、可視性、z-index、object-fit、そして操作の制御 — さらに挙動のヘルパー(.visually-hidden、.stretched-link、.ratio-*、.clearfix)。すべて Bootstrap とまったく同じ命名です。

配置 · .position-* + .top/.start/.translate-middle

比率 · .ratio .ratio-16x9

1x1
4x3
16x9
21x9

Overflow · 操作 · 左右の spacing

収まりきらない内容を持つブロックです。overflow-auto はページのレイアウトをはみ出す代わりに、内側のスクロールを足します。
user-select-nonepe-nonems-auto

フォーカスリング · .focus-ring

--hub-sys-focus-ring-* のトークンで制御されるフォーカスリングです。クリックするか Tab を押してください:

アクセシビリティ · .visually-hidden

この段落には、視覚的には隠れているがスクリーンリーダーには読み上げられる文が入っています: 支援技術のためだけの文(DOM を調べると見えます)。

<!-- badge positioned over the corner of its container -->
<div class="position-relative">
  …
  <span class="position-absolute top-0 start-100 translate-middle text-bg-danger rounded-pill px-2">9+</span>
</div>

<!-- media at a fixed ratio -->
<div class="ratio ratio-16x9"><iframe src="…"></iframe></div>

<!-- whole card clickable + screen-reader-only text -->
<div class="position-relative">
  <a href="…" class="stretched-link">See more<span class="visually-hidden"> about surfaces</span></a>
</div>

<!-- push with auto margins inside a flex row -->
<nav class="d-flex gap-2"><span>logo</span><a class="ms-auto">login</a></nav>

他システムへのブリッジ

その場にあるフレームワークと hub をつなぐ任意導入のミックスインです。呼ばなければコストはゼロ。$mode で 2 方向あります。adopt(hub がホストのテーマを取り込む)と project(hub が自分のテーマをホストに投影する)です。

@use 'ng-hub-ui-ds' as hub;

/* "I have Bootstrap and I want hub to adopt its palette" */
:root { @include hub.bridge-bootstrap($mode: adopt); }

/* "I want to tint Material and Tailwind with MY hub theme" */
:root { @include hub.bridge-material($mode: project); }
:root { @include hub.bridge-tailwind($mode: project); }
ミックスインシステムadoptproject
hub.bridge-bootstrapBootstrap 5.3+--bs-* を読む--bs-* とガター/角丸に色を付ける
hub.bridge-materialAngular Material 3--mat-sys-* を読む--mat-sys-* に色を付ける(color/on の対)
hub.bridge-tailwindTailwind v4--color-* を読む@theme 用に --color-* を出力する
hub.bridge-open-propsOpen Propsランプのエイリアス —

早見表

やりたいこと方法
パレットを使う@use '…/hub-tokens'
グローバルな色を変える:root { --hub-sys-color-primary: … }
独自のバリアントを足すwith ($hub-accents-extra: (brand: …))
コントラストのある文字color: var(--hub-sys-color-primary-on)
レイアウト(ミックスイン / ユーティリティ)@include hub.center() · .stack
テキスト(ミックスイン / ユーティリティ)@include hub.font-size(3) · .fs-3 .fw-bold .text-muted
サーフェス(ミックスイン / ユーティリティ)@include hub.text-bg(brand) · .bg-primary-subtle .rounded .shadow
配置 / ヘルパー.position-absolute .top-0 · .ratio-16x9 · .visually-hidden
レスポンシブ.col-md-6 · .flex-md-row · .offset-md-8 · @include hub.media-breakpoint-up(md)
Bootstrap/Material へのブリッジ@include hub.bridge-bootstrap($mode: adopt)
テーマを作る[data-theme='<name>'] { … }
部分的なテーマ設定(Sass)@include hub.theme($space: (3: 1.25rem), $accents: (primary: …))