angular-material
Angular 20以降のアプリケーションで、Material DesignのUIコンポーネント実装やテーマ設定、アクセシビリティ対応を行うSkill。
📜 元の英語説明(参考)
Angular Material component library expertise for Angular 20+ applications. Use when implementing Material Design components (buttons, forms, dialogs, tables, navigation), theming, accessibility, or building Angular UI with pre-built Material components. Covers all Material modules, component APIs, and best practices.
🇯🇵 日本人クリエイター向け解説
Angular 20以降のアプリケーションで、Material DesignのUIコンポーネント実装やテーマ設定、アクセシビリティ対応を行うSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o angular-material.zip https://jpskill.com/download/6835.zip && unzip -o angular-material.zip && rm angular-material.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/6835.zip -OutFile "$d\angular-material.zip"; Expand-Archive "$d\angular-material.zip" -DestinationPath $d -Force; ri "$d\angular-material.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
angular-material.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
angular-materialフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-17
- 取得日時
- 2026-05-17
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Angular Material コンポーネントライブラリ スキル
ルール
セットアップと設定
@angular/material、@angular/cdk、@angular/animationsをインストールする必要があります。app.config.tsでprovideAnimations()を設定する必要があります。- 特定の Material モジュール (例:
MatButtonModule、MatIconModule) をインポートする必要があります。 - ワイルドカード (
import * as Material) を使用してすべての Material モジュールをインポートしてはなりません。
フォームコントロール
- すべての
matInputは<mat-form-field>と<mat-label>でラップする必要があります。 - フォームフィールドには
appearance="outline"またはappearance="fill"を使用する必要があります。 - Material フォームコントロールでリアクティブフォームを使用する必要があります。
<mat-error>でバリデーションエラーメッセージを提供する必要があります。- 日付ピッカーには
MatDatepickerModuleとMatNativeDateModuleを使用する必要があります。
ナビゲーションコンポーネント
<mat-sidenav-container>に明示的な高さを設定する必要があります。- ナビゲーションリストには
@forとtrackを使用してmat-nav-listを使用する必要があります。 - セマンティックなスタイリング (
primary、accent、warn) にはcolor属性を使用する必要があります。
ボタンとアイコン
- 適切なボタンバリアントを使用する必要があります:
mat-button、mat-raised-button、mat-flat-button、mat-stroked-button、mat-icon-button、mat-fab、mat-mini-fab - アイコンのみのボタンには
aria-labelを提供する必要があります。 index.htmlで Material Icons フォントをインポートする必要があります。
データテーブル
- テーブルの列には
displayedColumnsを定義する必要があります。 - 列の定義には
matColumnDef、mat-header-cell、mat-cellを使用する必要があります。 - ソートには
mat-sort-headerとMatSortディレクティブを使用する必要があります。 ngAfterViewInit()でdataSource.sortとdataSource.paginatorを設定する必要があります。[pageSize]と[pageSizeOptions]を使用してMatPaginatorを使用する必要があります。
ダイアログとポップアップ
- ダイアログを開くには
MatDialogサービスを注入する必要があります。 <h2 mat-dialog-title>、<mat-dialog-content>、<mat-dialog-actions>の構造を使用する必要があります。- ダイアログアクションボタンには
[mat-dialog-close]を使用する必要があります。 - 開くオプションでダイアログの幅を設定する必要があります。
- ダイアログの結果を得るには
afterClosed()を購読する必要があります。
テーマ設定
- SCSS で
@use '@angular/material' as matを使用する必要があります。 mat.define-palette()でカスタムパレットを定義する必要があります。mat.define-light-theme()またはmat.define-dark-theme()でテーマを作成する必要があります。@include mat.all-component-themes($theme)を含める必要があります。
アクセシビリティ
- すべてのフォームフィールドにラベルを提供する必要があります。
- アイコンのみのボタンには ARIA 属性を追加する必要があります。
- キーボードナビゲーションのサポートを確保する必要があります。
- セマンティックな色属性 (
primary、accent、warn) を使用する必要があります。
パフォーマンス
- 必要な Material モジュールのみをインポートする必要があります。
- 重いコンポーネントの遅延読み込みには
@deferを使用する必要があります。 - 大規模なリストには仮想スクロールを使用する必要があります。
コンテキスト
概要
Angular Material は、Angular 用の公式 Material Design コンポーネントライブラリであり、アクセシビリティ、テーマ設定、TypeScript サポートが組み込まれた 50 以上の本番環境対応コンポーネントを提供します。
このスキルを使用するタイミング
- Material Design を使用して Angular アプリケーションを構築する場合
- Material フォームコントロールを使用してフォームを実装する場合
- ソート、ページネーション、フィルタリングを備えたデータテーブルを作成する場合
- Material サイドナビとツールバーを使用してナビゲーションを構築する場合
- ダイアログ、スナックバー、ボトムシートを実装する場合
- Material アイコンとボタンを使用する場合
- カスタムテーマを作成する場合
- アクセシビリティコンプライアンスを確保する場合
インストール
# Angular CLI を使用 (推奨)
ng add @angular/material
# または npm/pnpm を使用
pnpm install @angular/material @angular/cdk @angular/animations
アプリケーションのセットアップ
// app.config.ts (Angular 20+ スタンドアロン)
import { provideAnimations } from '@angular/platform-browser/animations';
export const appConfig: ApplicationConfig = {
providers: [
provideAnimations(),
// ... その他のプロバイダー
]
};
コンポーネントのインポート例
// スタンドアロンコンポーネント内
import { Component } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { MatToolbarModule } from '@angular/material/toolbar';
@Component({
selector: 'app-header',
standalone: true,
imports: [MatButtonModule, MatIconModule, MatToolbarModule],
template: `
<mat-toolbar color="primary">
<span>My App</span>
<span class="spacer"></span>
<button mat-icon-button>
<mat-icon>menu</mat-icon>
</button>
</mat-toolbar>
`
})
export class HeaderComponent {}
📚 コアコンポーネントカテゴリ
1. フォームコントロール
入力とテキストフィールド:
import { MatInputModule } from '@angular/material/input';
import { MatFormFieldModule } from '@angular/material/form-field';
import { FormControl, ReactiveFormsModule } from '@angular/forms';
@Component({
standalone: true,
imports: [MatFormFieldModule, MatInputModule, ReactiveFormsModule],
template: `
<mat-form-field appearance="outline">
<mat-label>Email</mat-label>
<input matInput [formControl]="email" placeholder="user@example.com">
<mat-hint>Enter your email address</mat-hint>
@if (email.hasError('email')) {
<mat-error>Invalid email format</mat-error>
}
</mat-form-field>
`
})
export class EmailInputComponent {
email = new FormControl('', [Validators.required, Validators.email]);
}
選択とオートコンプリート:
import { MatSelectModule } from '@angular/material/select';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
// 選択の例
<mat-form-field>
<mat-label>Country</mat-label>
<mat-select [formControl]="country">
@for (country of countries; track country.code) {
<mat-option [value]="country.code">{{ country.name }}</mat-option>
}
</mat-select>
</mat-form-field>
// オートコンプリートの例
<mat-form-field>
<mat-label>Search</mat-label>
<input matInput [formControl]="search" [matAutocomplete]="auto">
<mat-autocomplete #auto="matAutocomplete">
@for (option of filteredOptions(); track option) {
<mat-option [value]="option">{{ option }}</mat-option>
}
</mat-autocomplete>
</mat-form-field>
チェックボックスとラジオボタン:
(原文がここで切り詰められています) 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Angular Material Component Library Skill
Rules
Setup and Configuration
- Must install
@angular/material,@angular/cdk,@angular/animations - Must configure
provideAnimations()inapp.config.ts - Must import specific Material modules (e.g.,
MatButtonModule,MatIconModule) - Must NOT import all Material modules with wildcard (
import * as Material)
Form Controls
- Must wrap all
matInputin<mat-form-field>with<mat-label> - Must use
appearance="outline"orappearance="fill"for form fields - Must use Reactive Forms with Material form controls
- Must provide validation error messages with
<mat-error> - Must use
MatDatepickerModulewithMatNativeDateModulefor date pickers
Navigation Components
- Must set explicit height on
<mat-sidenav-container> - Must use
mat-nav-listfor navigation lists with@forandtrack - Must use
colorattribute for semantic styling (primary,accent,warn)
Buttons and Icons
- Must use appropriate button variant:
mat-button,mat-raised-button,mat-flat-button,mat-stroked-button,mat-icon-button,mat-fab,mat-mini-fab - Must provide
aria-labelfor icon-only buttons - Must import Material Icons font in
index.html
Data Tables
- Must define
displayedColumnsfor table columns - Must use
matColumnDef,mat-header-cell,mat-cellfor column definition - Must use
MatSortdirective withmat-sort-headerfor sorting - Must set
dataSource.sortanddataSource.paginatorinngAfterViewInit() - Must use
MatPaginatorwith[pageSize]and[pageSizeOptions]
Dialogs and Popups
- Must inject
MatDialogservice to open dialogs - Must use
<h2 mat-dialog-title>,<mat-dialog-content>,<mat-dialog-actions>structure - Must use
[mat-dialog-close]for dialog action buttons - Must configure dialog width in open options
- Must subscribe to
afterClosed()for dialog results
Theming
- Must use
@use '@angular/material' as matin SCSS - Must define custom palettes with
mat.define-palette() - Must create theme with
mat.define-light-theme()ormat.define-dark-theme() - Must include
@include mat.all-component-themes($theme)
Accessibility
- Must provide labels for all form fields
- Must add ARIA attributes for icon-only buttons
- Must ensure keyboard navigation support
- Must use semantic color attributes (
primary,accent,warn)
Performance
- Must import only needed Material modules
- Must use
@deferfor lazy loading heavy components - Must use virtual scrolling for large lists
Context
Summary
Angular Material is the official Material Design component library for Angular, providing 50+ production-ready components with built-in accessibility, theming, and TypeScript support.
When to Use This Skill
- Building Angular applications with Material Design
- Implementing forms with Material form controls
- Creating data tables with sorting, pagination, and filtering
- Building navigation with Material sidenav and toolbars
- Implementing dialogs, snackbars, and bottom sheets
- Using Material icons and buttons
- Creating custom themes
- Ensuring accessibility compliance
Installation
# Using Angular CLI (recommended)
ng add @angular/material
# Or using npm/pnpm
pnpm install @angular/material @angular/cdk @angular/animations
Application Setup
// app.config.ts (Angular 20+ standalone)
import { provideAnimations } from '@angular/platform-browser/animations';
export const appConfig: ApplicationConfig = {
providers: [
provideAnimations(),
// ... other providers
]
};
Component Import Example
// In standalone component
import { Component } from '@angular/core';
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
import { MatToolbarModule } from '@angular/material/toolbar';
@Component({
selector: 'app-header',
standalone: true,
imports: [MatButtonModule, MatIconModule, MatToolbarModule],
template: `
<mat-toolbar color="primary">
<span>My App</span>
<span class="spacer"></span>
<button mat-icon-button>
<mat-icon>menu</mat-icon>
</button>
</mat-toolbar>
`
})
export class HeaderComponent {}
📚 Core Component Categories
1. Form Controls
Input & Text Fields:
import { MatInputModule } from '@angular/material/input';
import { MatFormFieldModule } from '@angular/material/form-field';
import { FormControl, ReactiveFormsModule } from '@angular/forms';
@Component({
standalone: true,
imports: [MatFormFieldModule, MatInputModule, ReactiveFormsModule],
template: `
<mat-form-field appearance="outline">
<mat-label>Email</mat-label>
<input matInput [formControl]="email" placeholder="user@example.com">
<mat-hint>Enter your email address</mat-hint>
@if (email.hasError('email')) {
<mat-error>Invalid email format</mat-error>
}
</mat-form-field>
`
})
export class EmailInputComponent {
email = new FormControl('', [Validators.required, Validators.email]);
}
Select & Autocomplete:
import { MatSelectModule } from '@angular/material/select';
import { MatAutocompleteModule } from '@angular/material/autocomplete';
// Select example
<mat-form-field>
<mat-label>Country</mat-label>
<mat-select [formControl]="country">
@for (country of countries; track country.code) {
<mat-option [value]="country.code">{{ country.name }}</mat-option>
}
</mat-select>
</mat-form-field>
// Autocomplete example
<mat-form-field>
<mat-label>Search</mat-label>
<input matInput [formControl]="search" [matAutocomplete]="auto">
<mat-autocomplete #auto="matAutocomplete">
@for (option of filteredOptions(); track option) {
<mat-option [value]="option">{{ option }}</mat-option>
}
</mat-autocomplete>
</mat-form-field>
Checkboxes & Radio Buttons:
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatRadioModule } from '@angular/material/radio';
// Checkbox
<mat-checkbox [formControl]="agreeToTerms">
I agree to terms and conditions
</mat-checkbox>
// Radio group
<mat-radio-group [formControl]="selectedOption">
<mat-radio-button value="option1">Option 1</mat-radio-button>
<mat-radio-button value="option2">Option 2</mat-radio-button>
</mat-radio-group>
Date & Time Pickers:
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatNativeDateModule } from '@angular/material/core';
<mat-form-field>
<mat-label>Choose a date</mat-label>
<input matInput [matDatepicker]="picker" [formControl]="selectedDate">
<mat-datepicker-toggle matIconSuffix [for]="picker"></mat-datepicker-toggle>
<mat-datepicker #picker></mat-datepicker>
</mat-form-field>
2. Navigation Components
Toolbar:
import { MatToolbarModule } from '@angular/material/toolbar';
<mat-toolbar color="primary">
<button mat-icon-button>
<mat-icon>menu</mat-icon>
</button>
<span>Application Title</span>
<span class="spacer"></span>
<button mat-icon-button>
<mat-icon>account_circle</mat-icon>
</button>
</mat-toolbar>
Sidenav:
import { MatSidenavModule } from '@angular/material/sidenav';
<mat-sidenav-container class="sidenav-container">
<mat-sidenav #sidenav mode="side" opened>
<mat-nav-list>
@for (item of navItems; track item.route) {
<a mat-list-item [routerLink]="item.route">
<mat-icon>{{ item.icon }}</mat-icon>
{{ item.label }}
</a>
}
</mat-nav-list>
</mat-sidenav>
<mat-sidenav-content>
<router-outlet></router-outlet>
</mat-sidenav-content>
</mat-sidenav-container>
Tabs:
import { MatTabsModule } from '@angular/material/tabs';
<mat-tab-group>
<mat-tab label="Overview">
<div class="tab-content">Overview content</div>
</mat-tab>
<mat-tab label="Details">
<div class="tab-content">Details content</div>
</mat-tab>
<mat-tab label="Settings">
<div class="tab-content">Settings content</div>
</mat-tab>
</mat-tab-group>
3. Layout Components
Cards:
import { MatCardModule } from '@angular/material/card';
<mat-card>
<mat-card-header>
<mat-card-title>Card Title</mat-card-title>
<mat-card-subtitle>Card Subtitle</mat-card-subtitle>
</mat-card-header>
<img mat-card-image src="image.jpg" alt="Photo">
<mat-card-content>
<p>Card content goes here</p>
</mat-card-content>
<mat-card-actions>
<button mat-button>LIKE</button>
<button mat-button>SHARE</button>
</mat-card-actions>
</mat-card>
Grid List:
import { MatGridListModule } from '@angular/material/grid-list';
<mat-grid-list cols="3" rowHeight="200px">
@for (tile of tiles; track tile.id) {
<mat-grid-tile [colspan]="tile.cols" [rowspan]="tile.rows">
<img [src]="tile.image" [alt]="tile.title">
<mat-grid-tile-footer>
<h3>{{ tile.title }}</h3>
</mat-grid-tile-footer>
</mat-grid-tile>
}
</mat-grid-list>
4. Buttons & Indicators
Buttons:
import { MatButtonModule } from '@angular/material/button';
<!-- Different button types -->
<button mat-button>Basic</button>
<button mat-raised-button color="primary">Raised</button>
<button mat-flat-button color="accent">Flat</button>
<button mat-stroked-button>Stroked</button>
<button mat-icon-button><mat-icon>favorite</mat-icon></button>
<button mat-fab color="primary"><mat-icon>add</mat-icon></button>
<button mat-mini-fab color="accent"><mat-icon>edit</mat-icon></button>
Progress Indicators:
import { MatProgressSpinnerModule } from '@angular/material/progress-spinner';
import { MatProgressBarModule } from '@angular/material/progress-bar';
<!-- Spinner -->
<mat-spinner></mat-spinner>
<mat-spinner diameter="50"></mat-spinner>
<!-- Progress bar -->
<mat-progress-bar mode="indeterminate"></mat-progress-bar>
<mat-progress-bar mode="determinate" [value]="progressValue"></mat-progress-bar>
5. Popups & Modals
Dialog:
import { MatDialogModule, MatDialog } from '@angular/material/dialog';
// Open dialog
openDialog() {
const dialogRef = this.dialog.open(MyDialogComponent, {
width: '600px',
data: { name: 'User Name' }
});
dialogRef.afterClosed().subscribe(result => {
console.log('Dialog result:', result);
});
}
// Dialog component
@Component({
template: `
<h2 mat-dialog-title>Dialog Title</h2>
<mat-dialog-content>
<p>Dialog content</p>
</mat-dialog-content>
<mat-dialog-actions align="end">
<button mat-button mat-dialog-close>Cancel</button>
<button mat-raised-button color="primary" [mat-dialog-close]="true">
Confirm
</button>
</mat-dialog-actions>
`
})
export class MyDialogComponent {
constructor(@Inject(MAT_DIALOG_DATA) public data: any) {}
}
Snackbar:
import { MatSnackBarModule, MatSnackBar } from '@angular/material/snackbar';
showSnackbar() {
this.snackBar.open('Message sent successfully!', 'Close', {
duration: 3000,
horizontalPosition: 'end',
verticalPosition: 'top'
});
}
Bottom Sheet:
import { MatBottomSheetModule, MatBottomSheet } from '@angular/material/bottom-sheet';
openBottomSheet() {
this.bottomSheet.open(BottomSheetComponent);
}
6. Data Tables
Table with Sorting & Pagination:
import { MatTableModule } from '@angular/material/table';
import { MatSortModule, MatSort } from '@angular/material/sort';
import { MatPaginatorModule, MatPaginator } from '@angular/material/paginator';
@Component({
template: `
<table mat-table [dataSource]="dataSource" matSort>
<ng-container matColumnDef="name">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Name</th>
<td mat-cell *matCellDef="let element">{{ element.name }}</td>
</ng-container>
<ng-container matColumnDef="email">
<th mat-header-cell *matHeaderCellDef mat-sort-header>Email</th>
<td mat-cell *matCellDef="let element">{{ element.email }}</td>
</ng-container>
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
</table>
<mat-paginator [pageSize]="10" [pageSizeOptions]="[5, 10, 25, 100]">
</mat-paginator>
`
})
export class TableComponent implements AfterViewInit {
displayedColumns = ['name', 'email'];
dataSource = new MatTableDataSource(this.data);
@ViewChild(MatSort) sort!: MatSort;
@ViewChild(MatPaginator) paginator!: MatPaginator;
ngAfterViewInit() {
this.dataSource.sort = this.sort;
this.dataSource.paginator = this.paginator;
}
}
🎯 Best Practices
1. Import Only What You Need
// ✅ Good - Import specific modules
import { MatButtonModule } from '@angular/material/button';
import { MatIconModule } from '@angular/material/icon';
// ❌ Bad - Don't import everything
import * as Material from '@angular/material';
2. Use Appearance Variants
// Material form fields support different appearances
<mat-form-field appearance="fill"> <!-- Default -->
<mat-form-field appearance="outline"> <!-- Outlined -->
<mat-form-field appearance="legacy"> <!-- Deprecated -->
3. Leverage Color Themes
// Use color attribute for semantic styling
<button mat-raised-button color="primary">Primary</button>
<button mat-raised-button color="accent">Accent</button>
<button mat-raised-button color="warn">Warn</button>
4. Accessibility
// Always provide labels and ARIA attributes
<button mat-icon-button aria-label="Delete item">
<mat-icon>delete</mat-icon>
</button>
<mat-form-field>
<mat-label>Email</mat-label> <!-- Always include labels -->
<input matInput type="email">
</mat-form-field>
5. Responsive Design
// Use Material breakpoints
@use '@angular/material' as mat;
@media (max-width: mat.$small-breakpoint) {
.sidenav {
mode: 'over';
}
}
🔧 Theming
Custom Theme
@use '@angular/material' as mat;
$my-primary: mat.define-palette(mat.$indigo-palette);
$my-accent: mat.define-palette(mat.$pink-palette);
$my-warn: mat.define-palette(mat.$red-palette);
$my-theme: mat.define-light-theme((
color: (
primary: $my-primary,
accent: $my-accent,
warn: $my-warn,
),
typography: mat.define-typography-config(),
density: 0,
));
@include mat.all-component-themes($my-theme);
🐛 Troubleshooting
| Issue | Solution |
|---|---|
| Animations not working | Import provideAnimations() or BrowserAnimationsModule |
| Icons not showing | Import Material Icons font in index.html |
| Styles not applying | Import @angular/material/prebuilt-themes in styles.scss |
| Form field errors | Wrap input in <mat-form-field> with <mat-label> |
| Table not sorting | Add MatSort directive and set dataSource.sort |
| Dialog not opening | Inject MatDialog service and import MatDialogModule |
📖 References
- Angular Material Official Docs
- Component API Reference
- Material Design Guidelines
- Angular Material GitHub
📂 Recommended Placement
Project-level skill:
/.github/skills/angular-material/SKILL.md
Copilot will load this when working with Angular Material components.