@francofantomius/material-components 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/README.md +372 -106
- package/custom-elements.json +143 -143
- package/llms.txt +1407 -0
- package/package.json +3 -2
package/llms.txt
ADDED
|
@@ -0,0 +1,1407 @@
|
|
|
1
|
+
# @francofantomius/material-components
|
|
2
|
+
|
|
3
|
+
> Reusable, accessible, and lightweight Material Design 3 Web Components built with Lit.
|
|
4
|
+
|
|
5
|
+
`@francofantomius/material-components` is a comprehensive suite of modern, accessible, and lightweight **Material Design 3 (M3)** Web Components built with [Lit](https://lit.dev/). They run natively in all modern browsers and integrate seamlessly with React (18/19), Vue 3, Angular, Svelte, Solid, or vanilla HTML and JavaScript.
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Overview & Core Features](#overview--core-features)
|
|
10
|
+
- [Installation & Setup](#installation--setup)
|
|
11
|
+
- [Typography & Icons Setup](#typography--icons-setup)
|
|
12
|
+
- [Import Strategies](#import-strategies)
|
|
13
|
+
- [Theming & Color Palettes](#theming--color-palettes)
|
|
14
|
+
- [Form Integration (FACE)](#form-integration-face)
|
|
15
|
+
- [Framework Integration Guidelines](#framework-integration-guidelines)
|
|
16
|
+
- [React (18 / 19)](#react-18--19)
|
|
17
|
+
- [Vue 3](#vue-3)
|
|
18
|
+
- [Angular & Svelte](#angular--svelte)
|
|
19
|
+
- [Component Index](#component-index)
|
|
20
|
+
- [Component Reference](#component-reference)
|
|
21
|
+
- [Actions](#actions)
|
|
22
|
+
- [Button (`md-button`)](#button-md-button)
|
|
23
|
+
- [Icon Button (`md-icon-button`)](#icon-button-md-icon-button)
|
|
24
|
+
- [Floating Action Button (`md-fab`)](#floating-action-button-md-fab)
|
|
25
|
+
- [Inputs & Controls](#inputs--controls)
|
|
26
|
+
- [Text Field (`md-text-field`)](#text-field-md-text-field)
|
|
27
|
+
- [Checkbox (`md-checkbox`)](#checkbox-md-checkbox)
|
|
28
|
+
- [Radio & Radio Group (`md-radio`, `md-radio-group`)](#radio--radio-group-md-radio-md-radio-group)
|
|
29
|
+
- [Switch (`md-switch`)](#switch-md-switch)
|
|
30
|
+
- [Chip & Chip Set (`md-chip`, `md-chip-set`)](#chip--chip-set-md-chip-md-chip-set)
|
|
31
|
+
- [Search Bar (`md-search-bar`)](#search-bar-md-search-bar)
|
|
32
|
+
- [Surfaces & Containment](#surfaces--containment)
|
|
33
|
+
- [Card (`md-card`)](#card-md-card)
|
|
34
|
+
- [Dialog (`md-dialog`)](#dialog-md-dialog)
|
|
35
|
+
- [Divider (`md-divider`)](#divider-md-divider)
|
|
36
|
+
- [List & List Item (`md-list`, `md-list-item`)](#list--list-item-md-list-md-list-item)
|
|
37
|
+
- [Table & Data Table (`md-table`)](#table--data-table-md-table)
|
|
38
|
+
- [Communication & Feedback](#communication--feedback)
|
|
39
|
+
- [Badge (`md-badge`)](#badge-md-badge)
|
|
40
|
+
- [Progress Indicators (`md-progress`)](#progress-indicators-md-progress)
|
|
41
|
+
- [Snackbar (`md-snackbar`)](#snackbar-md-snackbar)
|
|
42
|
+
- [Navigation](#navigation)
|
|
43
|
+
- [Navigation Drawer (`md-navigation-drawer`, `md-navigation-drawer-item`)](#navigation-drawer-md-navigation-drawer-md-navigation-drawer-item)
|
|
44
|
+
- [Top App Bar (`md-top-app-bar`)](#top-app-bar-md-top-app-bar)
|
|
45
|
+
- [Tabs (`md-tabs`, `md-tab`)](#tabs-md-tabs-md-tab)
|
|
46
|
+
- [App Drawer (`md-app-drawer`, `md-app-drawer-item`)](#app-drawer-md-app-drawer-md-app-drawer-item)
|
|
47
|
+
- [Account Menu (`md-account-menu`, `md-account-item`)](#account-menu-md-account-menu-md-account-item)
|
|
48
|
+
- [Media & Playback](#media--playback)
|
|
49
|
+
- [Player (`md-player`)](#player-md-player)
|
|
50
|
+
- [Utilities & Data](#utilities--data)
|
|
51
|
+
- [Icon (`md-icon`)](#icon-md-icon)
|
|
52
|
+
- [Code Block & Highlighter (`md-code`)](#code-block--highlighter-md-code)
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Overview & Core Features
|
|
57
|
+
|
|
58
|
+
- **Material Design 3 Specifications**: Adheres to official M3 guidelines for tokenized color systems, dynamic elevation, state layers, rounded shapes, and typography.
|
|
59
|
+
- **Form-Associated Custom Elements (FACE)**: Text fields, checkboxes, switches, and radios utilize browser-native `ElementInternals` to participate in standard `<form>` submission, `FormData`, and native constraint validation (`required`, `checkValidity()`, `reportValidity()`).
|
|
60
|
+
- **Tree-Shakeable Subpaths**: Import only the elements you need (e.g., `@francofantomius/material-components/button`) to keep bundle sizes minimal.
|
|
61
|
+
- **Accessibility (a11y)**: Built-in WCAG 2.1 AA focus rings, full keyboard interactions, high-contrast support, and ARIA attributes.
|
|
62
|
+
- **TypeScript Support**: Full `.d.ts` type declarations and `custom-elements.json` (Custom Elements Manifest) for IDE autocomplete and linting.
|
|
63
|
+
- **Framework Agnostic**: Native Custom Elements work across React, Vue, Angular, Svelte, Solid, and vanilla HTML.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Installation & Setup
|
|
68
|
+
|
|
69
|
+
Install the library and its peer dependency `lit`:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npm install @francofantomius/material-components lit
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Typography & Icons Setup
|
|
78
|
+
|
|
79
|
+
Material 3 relies on **Roboto** for typography and **Material Symbols Outlined** for scalable vector icons. Include the Google Fonts stylesheets in your HTML `<head>`:
|
|
80
|
+
|
|
81
|
+
```html
|
|
82
|
+
<!-- Google Material Symbols Outlined font -->
|
|
83
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200" />
|
|
84
|
+
|
|
85
|
+
<!-- Google Roboto font -->
|
|
86
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;700&display=swap" />
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
91
|
+
## Import Strategies
|
|
92
|
+
|
|
93
|
+
### 1. Subpath Imports (Recommended for Production)
|
|
94
|
+
|
|
95
|
+
Import individual component modules to optimize tree-shaking:
|
|
96
|
+
|
|
97
|
+
```javascript
|
|
98
|
+
import '@francofantomius/material-components/button';
|
|
99
|
+
import '@francofantomius/material-components/text-field';
|
|
100
|
+
import '@francofantomius/material-components/card';
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 2. Full Component Bundle
|
|
104
|
+
|
|
105
|
+
For quick prototyping or full component registration:
|
|
106
|
+
|
|
107
|
+
```javascript
|
|
108
|
+
import '@francofantomius/material-components';
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Theming & Color Palettes
|
|
114
|
+
|
|
115
|
+
### Material Design 3 CSS Custom Properties
|
|
116
|
+
|
|
117
|
+
Configure tokens globally on `:root` or scope them to a container. Dark mode can be toggled using the `[data-theme='dark']` attribute:
|
|
118
|
+
|
|
119
|
+
```css
|
|
120
|
+
:root {
|
|
121
|
+
--md-sys-color-primary: #6750A4;
|
|
122
|
+
--md-sys-color-on-primary: #FFFFFF;
|
|
123
|
+
--md-sys-color-primary-container: #EADDFF;
|
|
124
|
+
--md-sys-color-on-primary-container: #21005D;
|
|
125
|
+
--md-sys-color-secondary: #625B71;
|
|
126
|
+
--md-sys-color-on-secondary: #FFFFFF;
|
|
127
|
+
--md-sys-color-surface: #FEF7FF;
|
|
128
|
+
--md-sys-color-on-surface: #1D1B20;
|
|
129
|
+
--md-sys-color-outline: #79747E;
|
|
130
|
+
--md-sys-color-error: #B3261E;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
[data-theme='dark'] {
|
|
134
|
+
--md-sys-color-primary: #D0BCFF;
|
|
135
|
+
--md-sys-color-on-primary: #381E72;
|
|
136
|
+
--md-sys-color-primary-container: #4F378B;
|
|
137
|
+
--md-sys-color-on-primary-container: #EADDFF;
|
|
138
|
+
--md-sys-color-secondary: #CCC2DC;
|
|
139
|
+
--md-sys-color-on-secondary: #332D41;
|
|
140
|
+
--md-sys-color-surface: #141218;
|
|
141
|
+
--md-sys-color-on-surface: #E6E0E9;
|
|
142
|
+
--md-sys-color-outline: #938F99;
|
|
143
|
+
--md-sys-color-error: #F2B8B5;
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### TypeScript Theme Helper API
|
|
148
|
+
|
|
149
|
+
The `@francofantomius/material-components/theme` module provides utilities for dynamic runtime palette assignment:
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
import { applyTheme, darkColorScheme, lightColorScheme } from '@francofantomius/material-components/theme';
|
|
153
|
+
|
|
154
|
+
// Switch to Dark Color Scheme
|
|
155
|
+
applyTheme(darkColorScheme);
|
|
156
|
+
|
|
157
|
+
// Switch back to Light Color Scheme
|
|
158
|
+
applyTheme(lightColorScheme);
|
|
159
|
+
|
|
160
|
+
// Apply Custom Brand Colors
|
|
161
|
+
applyTheme({
|
|
162
|
+
primary: '#006A60',
|
|
163
|
+
onPrimary: '#FFFFFF',
|
|
164
|
+
primaryContainer: '#74F8E5',
|
|
165
|
+
onPrimaryContainer: '#00201C',
|
|
166
|
+
});
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Form Integration (FACE)
|
|
172
|
+
|
|
173
|
+
Form controls (`<md-text-field>`, `<md-checkbox>`, `<md-switch>`, `<md-radio>`) are Form-Associated Custom Elements. They automatically participate in standard HTML forms and `FormData`.
|
|
174
|
+
|
|
175
|
+
### HTML Form Example
|
|
176
|
+
|
|
177
|
+
```html
|
|
178
|
+
<form id="signup-form">
|
|
179
|
+
<md-text-field
|
|
180
|
+
name="fullname"
|
|
181
|
+
label="Full Name"
|
|
182
|
+
required
|
|
183
|
+
supporting-text="Enter your first and last name"
|
|
184
|
+
></md-text-field>
|
|
185
|
+
|
|
186
|
+
<md-text-field
|
|
187
|
+
name="email"
|
|
188
|
+
label="Email Address"
|
|
189
|
+
type="email"
|
|
190
|
+
required
|
|
191
|
+
></md-text-field>
|
|
192
|
+
|
|
193
|
+
<md-checkbox name="newsletter" checked>
|
|
194
|
+
Receive monthly newsletter
|
|
195
|
+
</md-checkbox>
|
|
196
|
+
|
|
197
|
+
<md-switch name="telemetry" selected icons>
|
|
198
|
+
Anonymous analytics
|
|
199
|
+
</md-switch>
|
|
200
|
+
|
|
201
|
+
<div style="margin-top: 16px; display: flex; gap: 12px;">
|
|
202
|
+
<md-button type="reset" variant="outlined">Reset</md-button>
|
|
203
|
+
<md-button type="submit" variant="filled">Submit Form</md-button>
|
|
204
|
+
</div>
|
|
205
|
+
</form>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### JavaScript Handling
|
|
209
|
+
|
|
210
|
+
```javascript
|
|
211
|
+
const form = document.getElementById('signup-form');
|
|
212
|
+
|
|
213
|
+
form.addEventListener('submit', (e) => {
|
|
214
|
+
e.preventDefault();
|
|
215
|
+
|
|
216
|
+
if (!form.checkValidity()) {
|
|
217
|
+
form.reportValidity();
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const formData = new FormData(form);
|
|
222
|
+
const data = Object.fromEntries(formData.entries());
|
|
223
|
+
console.log('Submitted Payload:', data);
|
|
224
|
+
});
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## Framework Integration Guidelines
|
|
230
|
+
|
|
231
|
+
### React (18 / 19)
|
|
232
|
+
|
|
233
|
+
React 19 supports Custom Elements natively (properties, attributes, and custom events). In React 18, use standard props/attributes or refs for complex events and properties.
|
|
234
|
+
|
|
235
|
+
```tsx
|
|
236
|
+
import React, { useState } from 'react';
|
|
237
|
+
import '@francofantomius/material-components/button';
|
|
238
|
+
import '@francofantomius/material-components/text-field';
|
|
239
|
+
import '@francofantomius/material-components/switch';
|
|
240
|
+
|
|
241
|
+
export function UserSettings() {
|
|
242
|
+
const [username, setUsername] = useState('Alice');
|
|
243
|
+
const [notifications, setNotifications] = useState(true);
|
|
244
|
+
|
|
245
|
+
return (
|
|
246
|
+
<div>
|
|
247
|
+
<md-text-field
|
|
248
|
+
label="Username"
|
|
249
|
+
value={username}
|
|
250
|
+
onInput={(e: any) => setUsername(e.target.value)}
|
|
251
|
+
/>
|
|
252
|
+
<md-switch
|
|
253
|
+
selected={notifications}
|
|
254
|
+
onChange={(e: any) => setNotifications(e.target.selected)}
|
|
255
|
+
>
|
|
256
|
+
Notifications
|
|
257
|
+
</md-switch>
|
|
258
|
+
<md-button variant="filled" onClick={() => console.log('Saved!')}>
|
|
259
|
+
Save Settings
|
|
260
|
+
</md-button>
|
|
261
|
+
</div>
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Vue 3
|
|
267
|
+
|
|
268
|
+
Configure Vue's compiler to recognize `md-` tags as custom elements in `vite.config.js`:
|
|
269
|
+
|
|
270
|
+
```javascript
|
|
271
|
+
// vite.config.js
|
|
272
|
+
import { defineConfig } from 'vite';
|
|
273
|
+
import vue from '@vitejs/plugin-vue';
|
|
274
|
+
|
|
275
|
+
export default defineConfig({
|
|
276
|
+
plugins: [
|
|
277
|
+
vue({
|
|
278
|
+
template: {
|
|
279
|
+
compilerOptions: {
|
|
280
|
+
isCustomElement: (tag) => tag.startsWith('md-')
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
})
|
|
284
|
+
]
|
|
285
|
+
});
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
Use inside SFC template:
|
|
289
|
+
|
|
290
|
+
```html
|
|
291
|
+
<script setup>
|
|
292
|
+
import { ref } from 'vue';
|
|
293
|
+
import '@francofantomius/material-components/button';
|
|
294
|
+
import '@francofantomius/material-components/switch';
|
|
295
|
+
|
|
296
|
+
const isEnabled = ref(true);
|
|
297
|
+
</script>
|
|
298
|
+
|
|
299
|
+
<template>
|
|
300
|
+
<div>
|
|
301
|
+
<md-switch :selected="isEnabled" @change="isEnabled = !isEnabled">
|
|
302
|
+
Enable Feature
|
|
303
|
+
</md-switch>
|
|
304
|
+
<md-button variant="filled" :disabled="!isEnabled">
|
|
305
|
+
Proceed
|
|
306
|
+
</md-button>
|
|
307
|
+
</div>
|
|
308
|
+
</template>
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### Angular & Svelte
|
|
312
|
+
|
|
313
|
+
- **Angular**: Include `CUSTOM_ELEMENTS_SCHEMA` in `@NgModule({ schemas: [CUSTOM_ELEMENTS_SCHEMA] })` or standalone component definition.
|
|
314
|
+
- **Svelte**: Custom elements work natively with standard property and event bindings without extra wrappers.
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Component Index
|
|
319
|
+
|
|
320
|
+
| Category | Component Tag | Subpath Import | Description |
|
|
321
|
+
| :--- | :--- | :--- | :--- |
|
|
322
|
+
| **Actions** | `<md-button>` | `@francofantomius/material-components/button` | Buttons with 5 visual emphasis levels |
|
|
323
|
+
| **Actions** | `<md-icon-button>` | `@francofantomius/material-components/icon-button` | Compact action & toggle buttons |
|
|
324
|
+
| **Actions** | `<md-fab>` | `@francofantomius/material-components/fab` | Floating Action Button (small, medium, large, extended) |
|
|
325
|
+
| **Inputs & Controls** | `<md-text-field>` | `@francofantomius/material-components/text-field` | Filled & outlined inputs with validation |
|
|
326
|
+
| **Inputs & Controls** | `<md-checkbox>` | `@francofantomius/material-components/checkbox` | Checkbox with indeterminate and error states |
|
|
327
|
+
| **Inputs & Controls** | `<md-radio>`, `<md-radio-group>` | `@francofantomius/material-components/radio` | Mutually exclusive radio selections |
|
|
328
|
+
| **Inputs & Controls** | `<md-switch>` | `@francofantomius/material-components/switch` | Toggle switch with optional thumb icons |
|
|
329
|
+
| **Inputs & Controls** | `<md-chip>`, `<md-chip-set>` | `@francofantomius/material-components/chip` | Assist, filter, input, and suggestion chips |
|
|
330
|
+
| **Inputs & Controls** | `<md-search-bar>` | `@francofantomius/material-components/search-bar` | Docked and fullscreen search view |
|
|
331
|
+
| **Surfaces & Containment** | `<md-card>` | `@francofantomius/material-components/card` | Elevated, filled, and outlined surface containers |
|
|
332
|
+
| **Surfaces & Containment** | `<md-dialog>` | `@francofantomius/material-components/dialog` | Modal dialogs for prompts & confirmation |
|
|
333
|
+
| **Surfaces & Containment** | `<md-divider>` | `@francofantomius/material-components/divider` | Horizontal, vertical, and inset separators |
|
|
334
|
+
| **Surfaces & Containment** | `<md-list>`, `<md-list-item>` | `@francofantomius/material-components/list` | 1-line, 2-line, and 3-line structured lists |
|
|
335
|
+
| **Surfaces & Containment** | `<md-table>` | `@francofantomius/material-components/table` | Data table with sorting, selection, and pagination |
|
|
336
|
+
| **Communication & Feedback** | `<md-badge>` | `@francofantomius/material-components/badge` | Numeric count and status dot indicators |
|
|
337
|
+
| **Communication & Feedback** | `<md-progress>` | `@francofantomius/material-components/progress` | Linear and circular progress with M3 wavy lines |
|
|
338
|
+
| **Communication & Feedback** | `<md-snackbar>` | `@francofantomius/material-components/snackbar` | Temporary bottom toast messages |
|
|
339
|
+
| **Navigation** | `<md-navigation-drawer>` | `@francofantomius/material-components/navigation-drawer` | Side drawer navigation (modal / standard / responsive) |
|
|
340
|
+
| **Navigation** | `<md-top-app-bar>` | `@francofantomius/material-components/top-app-bar` | Header bar (small, center-aligned, medium, large) |
|
|
341
|
+
| **Navigation** | `<md-tabs>`, `<md-tab>` | `@francofantomius/material-components/tabs` | Top tab navigation with sliding active indicator |
|
|
342
|
+
| **Navigation** | `<md-app-drawer>` | `@francofantomius/material-components/app-drawer` | Popover application grid launcher with drag reordering |
|
|
343
|
+
| **Navigation** | `<md-account-menu>` | `@francofantomius/material-components/account-menu` | Account switcher, credentials, security & storage popover |
|
|
344
|
+
| **Media & Playback** | `<md-player>` | `@francofantomius/material-components/player` | Audio & video player with scrubber, queue, and volume |
|
|
345
|
+
| **Utilities & Data** | `<md-icon>` | `@francofantomius/material-components/icon` | Material Symbols font icon wrapper |
|
|
346
|
+
| **Utilities & Data** | `<md-code>` | `@francofantomius/material-components/code` | Syntax highlighter with real-time multi-language linting |
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## Component Reference
|
|
351
|
+
|
|
352
|
+
### Actions
|
|
353
|
+
|
|
354
|
+
#### Button (`md-button`)
|
|
355
|
+
|
|
356
|
+
- **Subpath**: `@francofantomius/material-components/button`
|
|
357
|
+
- **Description**: Buttons help users initiate actions and choices with five distinct levels of visual emphasis: filled, elevated, tonal, outlined, and text.
|
|
358
|
+
|
|
359
|
+
##### Properties & Attributes
|
|
360
|
+
| Name | Type | Default | Description |
|
|
361
|
+
| :--- | :--- | :--- | :--- |
|
|
362
|
+
| `variant` | `'filled' \| 'elevated' \| 'tonal' \| 'outlined' \| 'text'` | `'filled'` | Visual emphasis style of the button |
|
|
363
|
+
| `disabled` | `boolean` | `false` | Whether the button is interactive or disabled |
|
|
364
|
+
| `loading` | `boolean` | `false` | Displays an internal circular progress spinner and disables click |
|
|
365
|
+
| `icon` | `string` | `''` | Leading Material Symbols icon name |
|
|
366
|
+
| `trailing-icon` | `string` | `''` | Trailing Material Symbols icon name |
|
|
367
|
+
| `type` | `'button' \| 'submit' \| 'reset'` | `'button'` | HTML form button type |
|
|
368
|
+
| `href` | `string` | `''` | When provided, renders as an accessible anchor link |
|
|
369
|
+
| `target` | `string` | `''` | Link target attribute (e.g., `_blank`) |
|
|
370
|
+
|
|
371
|
+
##### Code Example
|
|
372
|
+
```html
|
|
373
|
+
<md-button variant="filled">Filled</md-button>
|
|
374
|
+
<md-button variant="elevated">Elevated</md-button>
|
|
375
|
+
<md-button variant="tonal">Tonal</md-button>
|
|
376
|
+
<md-button variant="outlined">Outlined</md-button>
|
|
377
|
+
<md-button variant="text">Text</md-button>
|
|
378
|
+
<md-button variant="filled" icon="add">Create New</md-button>
|
|
379
|
+
<md-button variant="outlined" trailing-icon="arrow_forward">Next Step</md-button>
|
|
380
|
+
<md-button variant="tonal" loading>Saving...</md-button>
|
|
381
|
+
<md-button variant="outlined" href="https://material.io" target="_blank" trailing-icon="open_in_new">
|
|
382
|
+
Material Design Docs
|
|
383
|
+
</md-button>
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
---
|
|
387
|
+
|
|
388
|
+
#### Icon Button (`md-icon-button`)
|
|
389
|
+
|
|
390
|
+
- **Subpath**: `@francofantomius/material-components/icon-button`
|
|
391
|
+
- **Description**: Icon buttons allow users to take compact actions and toggle choices with a single tap, supporting standard, filled, tonal, and outlined variants.
|
|
392
|
+
|
|
393
|
+
##### Properties & Attributes
|
|
394
|
+
| Name | Type | Default | Description |
|
|
395
|
+
| :--- | :--- | :--- | :--- |
|
|
396
|
+
| `variant` | `'standard' \| 'filled' \| 'tonal' \| 'outlined'` | `'standard'` | Visual container style |
|
|
397
|
+
| `icon` | `string` | `''` | Material Symbols icon name |
|
|
398
|
+
| `selected-icon` | `string` | `''` | Icon displayed when toggle button is active |
|
|
399
|
+
| `toggle` | `boolean` | `false` | Enables two-state toggle behavior |
|
|
400
|
+
| `selected` | `boolean` | `false` | Active selection state for toggle buttons |
|
|
401
|
+
| `disabled` | `boolean` | `false` | Disables button interactions |
|
|
402
|
+
| `href` | `string` | `''` | Renders as hyperlink when present |
|
|
403
|
+
|
|
404
|
+
##### Code Example
|
|
405
|
+
```html
|
|
406
|
+
<md-icon-button icon="favorite" variant="standard" aria-label="Favorite"></md-icon-button>
|
|
407
|
+
<md-icon-button icon="star" variant="filled" aria-label="Bookmark"></md-icon-button>
|
|
408
|
+
<md-icon-button icon="settings" variant="tonal" aria-label="Settings"></md-icon-button>
|
|
409
|
+
<md-icon-button icon="share" variant="outlined" aria-label="Share"></md-icon-button>
|
|
410
|
+
|
|
411
|
+
<!-- Toggle Icon Buttons -->
|
|
412
|
+
<md-icon-button toggle icon="bookmark_border" selected-icon="bookmark" aria-label="Bookmark"></md-icon-button>
|
|
413
|
+
<md-icon-button toggle variant="tonal" icon="notifications_none" selected-icon="notifications" aria-label="Alerts"></md-icon-button>
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
---
|
|
417
|
+
|
|
418
|
+
#### Floating Action Button (`md-fab`)
|
|
419
|
+
|
|
420
|
+
- **Subpath**: `@francofantomius/material-components/fab`
|
|
421
|
+
- **Description**: A Floating Action Button (FAB) performs the primary, most common action on a screen. Supports small, medium, large, and extended modes.
|
|
422
|
+
|
|
423
|
+
##### Properties & Attributes
|
|
424
|
+
| Name | Type | Default | Description |
|
|
425
|
+
| :--- | :--- | :--- | :--- |
|
|
426
|
+
| `size` | `'small' \| 'medium' \| 'large'` | `'medium'` | Container dimension |
|
|
427
|
+
| `icon` | `string` | `''` | Material Symbols icon name |
|
|
428
|
+
| `label` | `string` | `''` | Extended text label (renders extended FAB) |
|
|
429
|
+
| `lowered` | `boolean` | `false` | Applies lower elevation level 1 instead of level 3 |
|
|
430
|
+
| `disabled` | `boolean` | `false` | Disables button interaction |
|
|
431
|
+
|
|
432
|
+
##### Code Example
|
|
433
|
+
```html
|
|
434
|
+
<md-fab size="small" icon="edit" aria-label="Edit"></md-fab>
|
|
435
|
+
<md-fab icon="add" label="New Message"></md-fab>
|
|
436
|
+
<md-fab size="large" icon="palette" aria-label="Palette"></md-fab>
|
|
437
|
+
<md-fab icon="download" lowered aria-label="Download"></md-fab>
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
### Inputs & Controls
|
|
443
|
+
|
|
444
|
+
#### Text Field (`md-text-field`)
|
|
445
|
+
|
|
446
|
+
- **Subpath**: `@francofantomius/material-components/text-field`
|
|
447
|
+
- **Description**: Text fields allow users to enter and edit text, supporting filled and outlined variants, floating labels, validation states, and prefix/suffix text.
|
|
448
|
+
|
|
449
|
+
##### Properties & Attributes
|
|
450
|
+
| Name | Type | Default | Description |
|
|
451
|
+
| :--- | :--- | :--- | :--- |
|
|
452
|
+
| `variant` | `'filled' \| 'outlined'` | `'filled'` | Container visual style |
|
|
453
|
+
| `label` | `string` | `''` | Floating label text |
|
|
454
|
+
| `value` | `string` | `''` | Current input value |
|
|
455
|
+
| `type` | `string` | `'text'` | Input type (`text`, `email`, `password`, `number`, etc.) |
|
|
456
|
+
| `placeholder` | `string` | `''` | Placeholder displayed when focused |
|
|
457
|
+
| `prefix-text` | `string` | `''` | Affix text before the value |
|
|
458
|
+
| `suffix-text` | `string` | `''` | Affix text after the value |
|
|
459
|
+
| `supporting-text` | `string` | `''` | Helper text below the field |
|
|
460
|
+
| `error` | `boolean` | `false` | Forces input into error visual state |
|
|
461
|
+
| `error-text` | `string` | `''` | Error message shown when error is true |
|
|
462
|
+
| `leading-icon` | `string` | `''` | Material Symbols leading icon |
|
|
463
|
+
| `trailing-icon` | `string` | `''` | Material Symbols trailing icon |
|
|
464
|
+
| `maxlength` | `number` | `-1` | Maximum character length with visual counter |
|
|
465
|
+
| `required` | `boolean` | `false` | Form validation required constraint |
|
|
466
|
+
| `disabled` | `boolean` | `false` | Disables user input |
|
|
467
|
+
| `readonly` | `boolean` | `false` | Prevents text editing |
|
|
468
|
+
|
|
469
|
+
##### Code Example
|
|
470
|
+
```html
|
|
471
|
+
<md-text-field label="Full Name" supporting-text="Your legal name"></md-text-field>
|
|
472
|
+
<md-text-field variant="outlined" label="Email Address" type="email" leading-icon="mail"></md-text-field>
|
|
473
|
+
<md-text-field variant="outlined" label="Price" prefix-text="$" suffix-text=".00" value="99"></md-text-field>
|
|
474
|
+
<md-text-field variant="outlined" label="Bio" maxlength="50" supporting-text="Max 50 characters"></md-text-field>
|
|
475
|
+
<md-text-field variant="outlined" label="Password" type="password" error error-text="Password must be at least 8 characters" value="pass"></md-text-field>
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
#### Checkbox (`md-checkbox`)
|
|
481
|
+
|
|
482
|
+
- **Subpath**: `@francofantomius/material-components/checkbox`
|
|
483
|
+
- **Description**: Checkboxes allow users to select one or more items from a set, or toggle between checked, unchecked, and indeterminate states.
|
|
484
|
+
|
|
485
|
+
##### Properties & Attributes
|
|
486
|
+
| Name | Type | Default | Description |
|
|
487
|
+
| :--- | :--- | :--- | :--- |
|
|
488
|
+
| `checked` | `boolean` | `false` | Checked state |
|
|
489
|
+
| `indeterminate` | `boolean` | `false` | Partially selected state |
|
|
490
|
+
| `disabled` | `boolean` | `false` | Disables user interaction |
|
|
491
|
+
| `required` | `boolean` | `false` | Form validation constraint |
|
|
492
|
+
| `error` | `boolean` | `false` | Applies error color styling |
|
|
493
|
+
| `name` | `string` | `''` | HTML form input name |
|
|
494
|
+
| `value` | `string` | `'on'` | HTML form submitted value |
|
|
495
|
+
|
|
496
|
+
##### Code Example
|
|
497
|
+
```html
|
|
498
|
+
<md-checkbox checked>I agree to terms</md-checkbox>
|
|
499
|
+
<md-checkbox indeterminate>Select all children</md-checkbox>
|
|
500
|
+
<md-checkbox>Unchecked option</md-checkbox>
|
|
501
|
+
<md-checkbox disabled checked>Disabled selection</md-checkbox>
|
|
502
|
+
```
|
|
503
|
+
|
|
504
|
+
---
|
|
505
|
+
|
|
506
|
+
#### Radio & Radio Group (`md-radio`, `md-radio-group`)
|
|
507
|
+
|
|
508
|
+
- **Subpath**: `@francofantomius/material-components/radio`
|
|
509
|
+
- **Description**: Radio buttons allow users to select exactly one option from a set of mutually exclusive choices, organized within an `md-radio-group`.
|
|
510
|
+
|
|
511
|
+
##### `<md-radio>` Properties
|
|
512
|
+
| Name | Type | Default | Description |
|
|
513
|
+
| :--- | :--- | :--- | :--- |
|
|
514
|
+
| `checked` | `boolean` | `false` | Checked state of `md-radio` |
|
|
515
|
+
| `value` | `string` | `'on'` | Value associated with `md-radio` |
|
|
516
|
+
| `disabled` | `boolean` | `false` | Disables this radio button |
|
|
517
|
+
|
|
518
|
+
##### `<md-radio-group>` Properties
|
|
519
|
+
| Name | Type | Default | Description |
|
|
520
|
+
| :--- | :--- | :--- | :--- |
|
|
521
|
+
| `name` | `string` | `''` | Group name shared across radio buttons |
|
|
522
|
+
| `value` | `string` | `''` | Currently selected radio value |
|
|
523
|
+
| `row` | `boolean` | `false` | Arranges radio items horizontally |
|
|
524
|
+
|
|
525
|
+
##### Code Example
|
|
526
|
+
```html
|
|
527
|
+
<md-radio-group name="shipping" value="express">
|
|
528
|
+
<md-radio value="standard">Standard Shipping (3-5 days)</md-radio>
|
|
529
|
+
<md-radio value="express">Express Delivery (1-2 days)</md-radio>
|
|
530
|
+
<md-radio value="overnight" disabled>Overnight Priority (Unavailable)</md-radio>
|
|
531
|
+
</md-radio-group>
|
|
532
|
+
|
|
533
|
+
<md-radio-group row name="size" value="m">
|
|
534
|
+
<md-radio value="s">Small</md-radio>
|
|
535
|
+
<md-radio value="m">Medium</md-radio>
|
|
536
|
+
<md-radio value="l">Large</md-radio>
|
|
537
|
+
</md-radio-group>
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
---
|
|
541
|
+
|
|
542
|
+
#### Switch (`md-switch`)
|
|
543
|
+
|
|
544
|
+
- **Subpath**: `@francofantomius/material-components/switch`
|
|
545
|
+
- **Description**: Switches toggle the state of a single setting on or off, with optional check and cross icons inside the thumb.
|
|
546
|
+
|
|
547
|
+
##### Properties & Attributes
|
|
548
|
+
| Name | Type | Default | Description |
|
|
549
|
+
| :--- | :--- | :--- | :--- |
|
|
550
|
+
| `selected` | `boolean` | `false` | On/Off toggle state |
|
|
551
|
+
| `icons` | `boolean` | `false` | Displays check and cross icons inside thumb |
|
|
552
|
+
| `disabled` | `boolean` | `false` | Disables user interaction |
|
|
553
|
+
| `name` | `string` | `''` | HTML form input name |
|
|
554
|
+
| `value` | `string` | `'on'` | HTML form submitted value |
|
|
555
|
+
|
|
556
|
+
##### Code Example
|
|
557
|
+
```html
|
|
558
|
+
<md-switch selected icons>Wi-Fi</md-switch>
|
|
559
|
+
<md-switch selected>Bluetooth</md-switch>
|
|
560
|
+
<md-switch disabled>Airplane Mode</md-switch>
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
---
|
|
564
|
+
|
|
565
|
+
#### Chip & Chip Set (`md-chip`, `md-chip-set`)
|
|
566
|
+
|
|
567
|
+
- **Subpath**: `@francofantomius/material-components/chip`
|
|
568
|
+
- **Description**: Chips help users enter information, make selections, filter content, or trigger actions across assist, filter, input, and suggestion variants.
|
|
569
|
+
|
|
570
|
+
##### Properties & Attributes
|
|
571
|
+
| Name | Type | Default | Description |
|
|
572
|
+
| :--- | :--- | :--- | :--- |
|
|
573
|
+
| `variant` | `'assist' \| 'filter' \| 'input' \| 'suggestion'` | `'assist'` | Chip visual and interaction style |
|
|
574
|
+
| `label` | `string` | `''` | Chip text content |
|
|
575
|
+
| `icon` | `string` | `''` | Material Symbols leading icon |
|
|
576
|
+
| `selected` | `boolean` | `false` | Selected state for filter chips |
|
|
577
|
+
| `removable` | `boolean` | `false` | Shows trailing remove button for input chips |
|
|
578
|
+
| `disabled` | `boolean` | `false` | Disables chip interactions |
|
|
579
|
+
|
|
580
|
+
##### Code Example
|
|
581
|
+
```html
|
|
582
|
+
<md-chip-set>
|
|
583
|
+
<md-chip variant="assist" icon="event" label="Add to Calendar"></md-chip>
|
|
584
|
+
<md-chip variant="filter" selected label="Material 3"></md-chip>
|
|
585
|
+
<md-chip variant="input" label="Removable Tag" removable></md-chip>
|
|
586
|
+
<md-chip variant="suggestion" label="Suggested Query"></md-chip>
|
|
587
|
+
</md-chip-set>
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
---
|
|
591
|
+
|
|
592
|
+
#### Search Bar (`md-search-bar`)
|
|
593
|
+
|
|
594
|
+
- **Subpath**: `@francofantomius/material-components/search-bar`
|
|
595
|
+
- **Description**: Search bars allow users to enter queries and view search suggestions in docked or full-screen responsive views, following Material Design 3 guidelines.
|
|
596
|
+
|
|
597
|
+
##### Properties & Attributes
|
|
598
|
+
| Name | Type | Default | Description |
|
|
599
|
+
| :--- | :--- | :--- | :--- |
|
|
600
|
+
| `value` | `string` | `''` | Current query value in the search bar |
|
|
601
|
+
| `placeholder` | `string` | `'Search'` | Placeholder label for the input |
|
|
602
|
+
| `active` | `boolean` | `false` | Controls whether search view is expanded and showing suggestions |
|
|
603
|
+
| `suggestions` | `Array<string \| SearchSuggestion>` | `[]` | List of search suggestions with labels, supporting text, and icons |
|
|
604
|
+
| `leading-icon` | `string` | `'search'` | Leading icon displayed when inactive |
|
|
605
|
+
| `active-leading-icon` | `string` | `'arrow_back'` | Leading icon displayed when active |
|
|
606
|
+
| `trailing-icon` | `string` | `''` | Optional trailing action icon |
|
|
607
|
+
| `show-back-button` | `boolean` | `true` | Whether to show the back button in active mode |
|
|
608
|
+
| `responsive` | `boolean` | `true` | Automatically switches to full-screen view and collapsed search icon on mobile (<= 768px) |
|
|
609
|
+
| `collapse-on-mobile` | `boolean` | `true` | Collapses search bar into a compact search icon button on mobile screens when inactive |
|
|
610
|
+
| `fullscreen` | `boolean` | `false` | Forces full-screen search view overlay when active |
|
|
611
|
+
| `disabled` | `boolean` | `false` | Disables user interaction |
|
|
612
|
+
|
|
613
|
+
##### Slots
|
|
614
|
+
- `leading-icon`: Custom leading icon or button element.
|
|
615
|
+
- `trailing-icon`: Custom trailing action buttons, avatar, or mic.
|
|
616
|
+
- `suggestions`: Custom slotted suggestions list.
|
|
617
|
+
- `(default)`: Additional content rendered inside active search surface.
|
|
618
|
+
|
|
619
|
+
##### Events
|
|
620
|
+
- `input`: Fired as user types (`detail: { value: string }`).
|
|
621
|
+
- `change`: Fired on committed input change (`detail: { value: string }`).
|
|
622
|
+
- `search`: Fired when user presses Enter or selects a suggestion (`detail: { value: string, suggestion?: object }`).
|
|
623
|
+
- `active-change`: Fired when search bar expands/collapses (`detail: { active: boolean }`).
|
|
624
|
+
- `suggestion-select`: Fired when a suggestion is selected (`detail: { suggestion: object, value: string, index: number }`).
|
|
625
|
+
- `clear`: Fired when search value is cleared.
|
|
626
|
+
|
|
627
|
+
##### Code Example
|
|
628
|
+
```html
|
|
629
|
+
<md-search-bar
|
|
630
|
+
id="demo-search-bar"
|
|
631
|
+
placeholder="Search destinations, hotels, flights..."
|
|
632
|
+
trailing-icon="mic"
|
|
633
|
+
></md-search-bar>
|
|
634
|
+
|
|
635
|
+
<!-- Custom Slotted Content in Active State -->
|
|
636
|
+
<md-search-bar placeholder="Search files & documents">
|
|
637
|
+
<div style="padding: 12px 16px;">
|
|
638
|
+
<p style="margin: 0 0 8px 0; font-size: 13px; font-weight: 500;">Recent Searches</p>
|
|
639
|
+
<div style="display: flex; gap: 8px; flex-wrap: wrap;">
|
|
640
|
+
<md-chip label="Q4 Financial Report" icon="history"></md-chip>
|
|
641
|
+
<md-chip label="Design System M3" icon="history"></md-chip>
|
|
642
|
+
</div>
|
|
643
|
+
</div>
|
|
644
|
+
</md-search-bar>
|
|
645
|
+
```
|
|
646
|
+
|
|
647
|
+
---
|
|
648
|
+
|
|
649
|
+
### Surfaces & Containment
|
|
650
|
+
|
|
651
|
+
#### Card (`md-card`)
|
|
652
|
+
|
|
653
|
+
- **Subpath**: `@francofantomius/material-components/card`
|
|
654
|
+
- **Description**: Cards contain content and actions about a single subject, available in elevated, filled, and outlined styles with optional ripple interactivity.
|
|
655
|
+
|
|
656
|
+
##### Properties & Attributes
|
|
657
|
+
| Name | Type | Default | Description |
|
|
658
|
+
| :--- | :--- | :--- | :--- |
|
|
659
|
+
| `variant` | `'elevated' \| 'filled' \| 'outlined'` | `'elevated'` | Card visual style |
|
|
660
|
+
| `interactive` | `boolean` | `false` | Enables hover elevation and ripple effect |
|
|
661
|
+
| `disabled` | `boolean` | `false` | Disables card interactions |
|
|
662
|
+
| `href` | `string` | `''` | Renders card as anchor link |
|
|
663
|
+
| `target` | `string` | `''` | Anchor target when href is provided |
|
|
664
|
+
|
|
665
|
+
##### Slots
|
|
666
|
+
- `header`: Top card header content.
|
|
667
|
+
- `actions`: Bottom actions button container.
|
|
668
|
+
- `(default)`: Main card body content.
|
|
669
|
+
|
|
670
|
+
##### Code Example
|
|
671
|
+
```html
|
|
672
|
+
<md-card variant="outlined" style="max-width: 340px;">
|
|
673
|
+
<div slot="header">
|
|
674
|
+
<h3 style="margin: 0; font-size: 18px;">Outlined Card</h3>
|
|
675
|
+
</div>
|
|
676
|
+
Explore our Material Design 3 component library with built-in interactive feedback.
|
|
677
|
+
<div slot="actions">
|
|
678
|
+
<md-button variant="text">Dismiss</md-button>
|
|
679
|
+
<md-button variant="filled">Learn More</md-button>
|
|
680
|
+
</div>
|
|
681
|
+
</md-card>
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
---
|
|
685
|
+
|
|
686
|
+
#### Dialog (`md-dialog`)
|
|
687
|
+
|
|
688
|
+
- **Subpath**: `@francofantomius/material-components/dialog`
|
|
689
|
+
- **Description**: Dialogs inform users about a task and can contain critical information, require decisions, or involve multiple tasks.
|
|
690
|
+
|
|
691
|
+
##### Properties & Attributes
|
|
692
|
+
| Name | Type | Default | Description |
|
|
693
|
+
| :--- | :--- | :--- | :--- |
|
|
694
|
+
| `open` | `boolean` | `false` | Reflects open/closed state of modal |
|
|
695
|
+
| `headline` | `string` | `''` | Header title text |
|
|
696
|
+
| `icon` | `string` | `''` | Material Symbols header icon |
|
|
697
|
+
|
|
698
|
+
##### Slots
|
|
699
|
+
- `actions`: Modal action buttons (Cancel, Confirm).
|
|
700
|
+
- `(default)`: Dialog message body content.
|
|
701
|
+
|
|
702
|
+
##### Events
|
|
703
|
+
- `open`: Dispatched when dialog modal opens.
|
|
704
|
+
- `close`: Dispatched when dialog closes (`detail: { returnValue?: string }`).
|
|
705
|
+
- `cancel`: Dispatched when dialog is dismissed via Escape key.
|
|
706
|
+
|
|
707
|
+
##### Code Example
|
|
708
|
+
```html
|
|
709
|
+
<md-button variant="filled" id="open-dialog-btn">Open Dialog</md-button>
|
|
710
|
+
|
|
711
|
+
<md-dialog id="demo-dialog" headline="Discard Draft?" icon="warning">
|
|
712
|
+
Are you sure you want to discard your changes? This action cannot be undone.
|
|
713
|
+
<div slot="actions">
|
|
714
|
+
<md-button variant="text" id="cancel-btn">Cancel</md-button>
|
|
715
|
+
<md-button variant="filled" id="confirm-btn">Discard</md-button>
|
|
716
|
+
</div>
|
|
717
|
+
</md-dialog>
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
---
|
|
721
|
+
|
|
722
|
+
#### Divider (`md-divider`)
|
|
723
|
+
|
|
724
|
+
- **Subpath**: `@francofantomius/material-components/divider`
|
|
725
|
+
- **Description**: A divider is a thin line that groups content in lists and page layouts, supporting inset and vertical orientations.
|
|
726
|
+
|
|
727
|
+
##### Properties & Attributes
|
|
728
|
+
| Name | Type | Default | Description |
|
|
729
|
+
| :--- | :--- | :--- | :--- |
|
|
730
|
+
| `vertical` | `boolean` | `false` | Renders a vertical divider |
|
|
731
|
+
| `inset` | `boolean` | `false` | Adds 16px start and end margins |
|
|
732
|
+
| `inset-start` | `boolean` | `false` | Adds 16px margin only to the start |
|
|
733
|
+
| `inset-end` | `boolean` | `false` | Adds 16px margin only to the end |
|
|
734
|
+
|
|
735
|
+
##### Code Example
|
|
736
|
+
```html
|
|
737
|
+
<div>Section Item Alpha</div>
|
|
738
|
+
<md-divider></md-divider>
|
|
739
|
+
<div>Section Item Beta</div>
|
|
740
|
+
<md-divider inset></md-divider>
|
|
741
|
+
<div>Section Item Gamma</div>
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
---
|
|
745
|
+
|
|
746
|
+
#### List & List Item (`md-list`, `md-list-item`)
|
|
747
|
+
|
|
748
|
+
- **Subpath**: `@francofantomius/material-components/list`
|
|
749
|
+
- **Description**: Lists are continuous, vertical indexes of text and images, supporting 1-line, 2-line, and 3-line items with icons, avatars, and trailing text.
|
|
750
|
+
|
|
751
|
+
##### `<md-list-item>` Properties
|
|
752
|
+
| Name | Type | Default | Description |
|
|
753
|
+
| :--- | :--- | :--- | :--- |
|
|
754
|
+
| `headline` | `string` | `''` | Primary headline text |
|
|
755
|
+
| `supporting-text` | `string` | `''` | Secondary supporting text description |
|
|
756
|
+
| `trailing-supporting-text` | `string` | `''` | Metadata timestamp or trailing text |
|
|
757
|
+
| `interactive` | `boolean` | `false` | Enables ripple hover and click response |
|
|
758
|
+
| `disabled` | `boolean` | `false` | Disables item |
|
|
759
|
+
| `href` | `string` | `''` | Renders item as hyperlink |
|
|
760
|
+
|
|
761
|
+
##### `<md-list-item>` Slots
|
|
762
|
+
- `start`: Leading icon, checkbox, or avatar.
|
|
763
|
+
- `end`: Trailing icon, button, or switch.
|
|
764
|
+
|
|
765
|
+
##### Code Example
|
|
766
|
+
```html
|
|
767
|
+
<md-list style="max-width: 400px; background: var(--md-sys-color-surface-container-low); border-radius: 12px;">
|
|
768
|
+
<md-list-item headline="Sarah Connor" supporting-text="Uploaded project roadmap" trailing-supporting-text="10:30 AM" interactive>
|
|
769
|
+
<md-icon slot="start" name="account_circle" size="32"></md-icon>
|
|
770
|
+
</md-list-item>
|
|
771
|
+
<md-divider inset></md-divider>
|
|
772
|
+
<md-list-item headline="Security Update" supporting-text="All packages upgraded to v2.0" trailing-supporting-text="Yesterday" interactive>
|
|
773
|
+
<md-icon slot="start" name="shield" size="32"></md-icon>
|
|
774
|
+
</md-list-item>
|
|
775
|
+
</md-list>
|
|
776
|
+
```
|
|
777
|
+
|
|
778
|
+
---
|
|
779
|
+
|
|
780
|
+
#### Table & Data Table (`md-table`)
|
|
781
|
+
|
|
782
|
+
- **Subpath**: `@francofantomius/material-components/table`
|
|
783
|
+
- **Description**: Data tables display information in a structured grid of rows and columns, featuring automatic sorting, pagination, zebra striping, loading states, and multi-row selection.
|
|
784
|
+
|
|
785
|
+
##### Properties & Attributes
|
|
786
|
+
| Name | Type | Default | Description |
|
|
787
|
+
| :--- | :--- | :--- | :--- |
|
|
788
|
+
| `bordered` | `boolean` | `false` | Adds outer container and cell grid borders |
|
|
789
|
+
| `elevated` | `boolean` | `false` | Applies Material elevation shadow |
|
|
790
|
+
| `striped` | `boolean` | `false` | Zebra stripes alternating rows |
|
|
791
|
+
| `hoverable` | `boolean` | `true` | Highlights rows on mouse hover |
|
|
792
|
+
| `dense` | `boolean` | `false` | Compact cell and row padding |
|
|
793
|
+
| `sticky-header` | `boolean` | `false` | Pins table header during scroll |
|
|
794
|
+
| `loading` | `boolean` | `false` | Displays indeterminate top progress bar |
|
|
795
|
+
| `selectable` | `boolean` | `false` | Enables row selection checkboxes |
|
|
796
|
+
| `columns` | `TableColumn[]` | `[]` | Data-driven column configuration array |
|
|
797
|
+
| `rows` | `Record<string, any>[]` | `[]` | Data-driven row data array |
|
|
798
|
+
| `paginated` | `boolean` | `false` | Renders built-in pagination footer |
|
|
799
|
+
| `page` | `number` | `1` | Active page index (1-based) |
|
|
800
|
+
| `page-size` | `number` | `10` | Items per page |
|
|
801
|
+
| `total` | `number` | `0` | Total row count |
|
|
802
|
+
|
|
803
|
+
##### Events
|
|
804
|
+
- `sort-change`: Fired when column sorting is toggled (`detail: { column: string, direction: "asc" | "desc" | "none" }`).
|
|
805
|
+
- `row-click`: Fired when a row is clicked (`detail: { row: any, index: number }`).
|
|
806
|
+
- `selection-change`: Fired when row selection changes (`detail: { selectedRows: any[] }`).
|
|
807
|
+
- `page-change`: Fired when page changes (`detail: { page: number, pageSize: number }`).
|
|
808
|
+
|
|
809
|
+
##### Code Example
|
|
810
|
+
```html
|
|
811
|
+
<md-table
|
|
812
|
+
id="demo-table"
|
|
813
|
+
bordered
|
|
814
|
+
striped
|
|
815
|
+
hoverable
|
|
816
|
+
elevated
|
|
817
|
+
selectable
|
|
818
|
+
paginated
|
|
819
|
+
page-size="5"
|
|
820
|
+
style="width: 100%;"
|
|
821
|
+
></md-table>
|
|
822
|
+
|
|
823
|
+
<script>
|
|
824
|
+
const table = document.getElementById('demo-table');
|
|
825
|
+
table.columns = [
|
|
826
|
+
{ key: 'name', label: 'Name', sortable: true },
|
|
827
|
+
{ key: 'role', label: 'Role', sortable: true },
|
|
828
|
+
{ key: 'status', label: 'Status' }
|
|
829
|
+
];
|
|
830
|
+
table.rows = [
|
|
831
|
+
{ name: 'Alice Smith', role: 'Architect', status: 'Active' },
|
|
832
|
+
{ name: 'Bob Jones', role: 'Developer', status: 'Away' }
|
|
833
|
+
];
|
|
834
|
+
</script>
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
---
|
|
838
|
+
|
|
839
|
+
### Communication & Feedback
|
|
840
|
+
|
|
841
|
+
#### Badge (`md-badge`)
|
|
842
|
+
|
|
843
|
+
- **Subpath**: `@francofantomius/material-components/badge`
|
|
844
|
+
- **Description**: Badges show notification counts, alert statuses, or small indicators anchored to icon buttons or list elements.
|
|
845
|
+
|
|
846
|
+
##### Properties & Attributes
|
|
847
|
+
| Name | Type | Default | Description |
|
|
848
|
+
| :--- | :--- | :--- | :--- |
|
|
849
|
+
| `value` | `string` | `''` | Badge numeric or text value |
|
|
850
|
+
| `dot` | `boolean` | `false` | Renders a small 6px dot without text |
|
|
851
|
+
|
|
852
|
+
##### Code Example
|
|
853
|
+
```html
|
|
854
|
+
<div style="display: flex; gap: 24px; align-items: center;">
|
|
855
|
+
<md-badge value="4">
|
|
856
|
+
<md-icon-button icon="mail" aria-label="Mail"></md-icon-button>
|
|
857
|
+
</md-badge>
|
|
858
|
+
<md-badge value="99+">
|
|
859
|
+
<md-icon-button icon="notifications" aria-label="Notifications"></md-icon-button>
|
|
860
|
+
</md-badge>
|
|
861
|
+
<md-badge dot>
|
|
862
|
+
<md-icon-button icon="chat" aria-label="Messages"></md-icon-button>
|
|
863
|
+
</md-badge>
|
|
864
|
+
</div>
|
|
865
|
+
```
|
|
866
|
+
|
|
867
|
+
---
|
|
868
|
+
|
|
869
|
+
#### Progress Indicators (`md-progress`)
|
|
870
|
+
|
|
871
|
+
- **Subpath**: `@francofantomius/material-components/progress`
|
|
872
|
+
- **Description**: Progress indicators express an unspecified wait time or display the length of a process in linear and circular formats, featuring Material 3 wavy lines for determinate values.
|
|
873
|
+
|
|
874
|
+
##### Properties & Attributes
|
|
875
|
+
| Name | Type | Default | Description |
|
|
876
|
+
| :--- | :--- | :--- | :--- |
|
|
877
|
+
| `type` | `'linear' \| 'circular'` | `'linear'` | Indicator shape |
|
|
878
|
+
| `value` | `number \| null` | `null` | Determinate value between 0 and 1. `null` indicates indeterminate. |
|
|
879
|
+
| `max` | `number` | `1` | Maximum progress value |
|
|
880
|
+
| `buffer` | `number` | `1` | Buffer value for linear progress indicator |
|
|
881
|
+
| `wavy` | `boolean` | `true` | Enables Material 3 wavy line for determinate values |
|
|
882
|
+
|
|
883
|
+
##### Code Example
|
|
884
|
+
```html
|
|
885
|
+
<!-- Linear Progress with Wavy Line -->
|
|
886
|
+
<md-progress type="linear" value="0.7"></md-progress>
|
|
887
|
+
<md-progress type="linear"></md-progress>
|
|
888
|
+
|
|
889
|
+
<!-- Circular Progress with Wavy Line -->
|
|
890
|
+
<md-progress type="circular" value="0.65"></md-progress>
|
|
891
|
+
<md-progress type="circular"></md-progress>
|
|
892
|
+
```
|
|
893
|
+
|
|
894
|
+
---
|
|
895
|
+
|
|
896
|
+
#### Snackbar (`md-snackbar`)
|
|
897
|
+
|
|
898
|
+
- **Subpath**: `@francofantomius/material-components/snackbar`
|
|
899
|
+
- **Description**: Snackbars provide brief feedback about an operation through an elevated message toast at the bottom of the viewport.
|
|
900
|
+
|
|
901
|
+
##### Properties & Attributes
|
|
902
|
+
| Name | Type | Default | Description |
|
|
903
|
+
| :--- | :--- | :--- | :--- |
|
|
904
|
+
| `open` | `boolean` | `false` | Visibility state |
|
|
905
|
+
| `message` | `string` | `''` | Message toast content |
|
|
906
|
+
| `action-text` | `string` | `''` | Action button label |
|
|
907
|
+
| `closeable` | `boolean` | `false` | Renders a close icon button |
|
|
908
|
+
| `timeout-ms` | `number` | `4000` | Auto-dismiss timeout in milliseconds (0 for indefinite) |
|
|
909
|
+
|
|
910
|
+
##### Events
|
|
911
|
+
- `open`: Fired when snackbar appears.
|
|
912
|
+
- `close`: Fired when snackbar dismisses.
|
|
913
|
+
- `action`: Fired when user clicks action button.
|
|
914
|
+
|
|
915
|
+
##### Code Example
|
|
916
|
+
```html
|
|
917
|
+
<md-button variant="tonal" id="show-toast-btn">Show Snackbar</md-button>
|
|
918
|
+
<md-snackbar id="demo-toast" message="Email message moved to Trash." action-text="Undo" closeable></md-snackbar>
|
|
919
|
+
|
|
920
|
+
<script>
|
|
921
|
+
document.getElementById('show-toast-btn').addEventListener('click', () => {
|
|
922
|
+
document.getElementById('demo-toast').open = true;
|
|
923
|
+
});
|
|
924
|
+
</script>
|
|
925
|
+
```
|
|
926
|
+
|
|
927
|
+
---
|
|
928
|
+
|
|
929
|
+
### Navigation
|
|
930
|
+
|
|
931
|
+
#### Navigation Drawer (`md-navigation-drawer`, `md-navigation-drawer-item`)
|
|
932
|
+
|
|
933
|
+
- **Subpath**: `@francofantomius/material-components/navigation-drawer`
|
|
934
|
+
- **Description**: Navigation drawers provide side navigation access to top-level destinations and app features in standard or modal configurations.
|
|
935
|
+
|
|
936
|
+
##### `<md-navigation-drawer>` Properties
|
|
937
|
+
| Name | Type | Default | Description |
|
|
938
|
+
| :--- | :--- | :--- | :--- |
|
|
939
|
+
| `open` | `boolean` | `false` | Reflects open/closed state |
|
|
940
|
+
| `type` | `'modal' \| 'standard' \| 'responsive'` | `'modal'` | Drawer presentation mode |
|
|
941
|
+
| `responsive` | `boolean` | `false` | Enables responsive mode (docked on desktop >960px, modal on mobile) |
|
|
942
|
+
| `pivot` | `'left' \| 'right'` | `'left'` | Anchoring screen edge |
|
|
943
|
+
| `headline` | `string` | `''` | Drawer title header |
|
|
944
|
+
|
|
945
|
+
##### `<md-navigation-drawer-item>` Properties
|
|
946
|
+
| Name | Type | Default | Description |
|
|
947
|
+
| :--- | :--- | :--- | :--- |
|
|
948
|
+
| `icon` | `string` | `''` | Material Symbols destination icon |
|
|
949
|
+
| `label` | `string` | `''` | Destination title |
|
|
950
|
+
| `badge` | `string` | `''` | Trailing counter or status badge |
|
|
951
|
+
| `active` | `boolean` | `false` | Highlights item with active pill indicator |
|
|
952
|
+
| `disabled` | `boolean` | `false` | Disables item |
|
|
953
|
+
| `href` | `string` | `''` | Optional navigation link |
|
|
954
|
+
|
|
955
|
+
##### Events
|
|
956
|
+
- `open`: Dispatched when drawer opens.
|
|
957
|
+
- `close`: Dispatched when drawer closes.
|
|
958
|
+
- `item-click`: Dispatched when a drawer item is selected.
|
|
959
|
+
|
|
960
|
+
##### Code Example
|
|
961
|
+
```html
|
|
962
|
+
<md-navigation-drawer id="demo-drawer" headline="Mail Destinations">
|
|
963
|
+
<md-navigation-drawer-item icon="inbox" label="Inbox" badge="12" active></md-navigation-drawer-item>
|
|
964
|
+
<md-navigation-drawer-item icon="star" label="Starred"></md-navigation-drawer-item>
|
|
965
|
+
<md-navigation-drawer-item icon="send" label="Sent"></md-navigation-drawer-item>
|
|
966
|
+
<md-navigation-drawer-item icon="drafts" label="Drafts" badge="2"></md-navigation-drawer-item>
|
|
967
|
+
<div slot="footer">
|
|
968
|
+
<md-navigation-drawer-item icon="settings" label="Settings"></md-navigation-drawer-item>
|
|
969
|
+
</div>
|
|
970
|
+
</md-navigation-drawer>
|
|
971
|
+
```
|
|
972
|
+
|
|
973
|
+
---
|
|
974
|
+
|
|
975
|
+
#### Top App Bar (`md-top-app-bar`)
|
|
976
|
+
|
|
977
|
+
- **Subpath**: `@francofantomius/material-components/top-app-bar`
|
|
978
|
+
- **Description**: Top app bars display branding, titles, navigation controls, and actions at the top of a screen across small, center-aligned, medium, and large variants.
|
|
979
|
+
|
|
980
|
+
##### Properties & Attributes
|
|
981
|
+
| Name | Type | Default | Description |
|
|
982
|
+
| :--- | :--- | :--- | :--- |
|
|
983
|
+
| `variant` | `'center-aligned' \| 'small' \| 'medium' \| 'large'` | `'center-aligned'` | Layout format of the top bar |
|
|
984
|
+
| `headline` | `string` | `''` | Main title headline |
|
|
985
|
+
| `subtitle` | `string` | `''` | Secondary supporting text |
|
|
986
|
+
| `elevated` | `boolean` | `false` | Applies elevation shadow and surface container color |
|
|
987
|
+
| `fixed` | `boolean` | `false` | Pins app bar to top of viewport (sticky) |
|
|
988
|
+
|
|
989
|
+
##### Slots
|
|
990
|
+
- `navigation`: Leading icon button (e.g. Hamburger menu or back arrow).
|
|
991
|
+
- `actions`: Trailing action buttons and overflow menu triggers.
|
|
992
|
+
|
|
993
|
+
##### Code Example
|
|
994
|
+
```html
|
|
995
|
+
<md-top-app-bar variant="small" headline="Inbox" subtitle="3 unread messages">
|
|
996
|
+
<md-icon-button slot="navigation" icon="menu" aria-label="Menu"></md-icon-button>
|
|
997
|
+
<md-icon-button slot="actions" icon="search" aria-label="Search"></md-icon-button>
|
|
998
|
+
<md-icon-button slot="actions" icon="more_vert" aria-label="More"></md-icon-button>
|
|
999
|
+
</md-top-app-bar>
|
|
1000
|
+
|
|
1001
|
+
<md-top-app-bar variant="center-aligned" headline="Settings" elevated>
|
|
1002
|
+
<md-icon-button slot="navigation" icon="arrow_back" aria-label="Back"></md-icon-button>
|
|
1003
|
+
<md-icon-button slot="actions" icon="help" aria-label="Help"></md-icon-button>
|
|
1004
|
+
</md-top-app-bar>
|
|
1005
|
+
```
|
|
1006
|
+
|
|
1007
|
+
---
|
|
1008
|
+
|
|
1009
|
+
#### Tabs (`md-tabs`, `md-tab`)
|
|
1010
|
+
|
|
1011
|
+
- **Subpath**: `@francofantomius/material-components/tabs`
|
|
1012
|
+
- **Description**: Tabs organize content across different screens, data sets, and other interactions with smooth sliding active indicator bars.
|
|
1013
|
+
|
|
1014
|
+
##### `<md-tabs>` Properties
|
|
1015
|
+
| Name | Type | Default | Description |
|
|
1016
|
+
| :--- | :--- | :--- | :--- |
|
|
1017
|
+
| `active-index` | `number` | `0` | 0-based index of currently active tab |
|
|
1018
|
+
|
|
1019
|
+
##### `<md-tab>` Properties
|
|
1020
|
+
| Name | Type | Default | Description |
|
|
1021
|
+
| :--- | :--- | :--- | :--- |
|
|
1022
|
+
| `label` | `string` | `''` | Tab text title |
|
|
1023
|
+
| `icon` | `string` | `''` | Material Symbols icon |
|
|
1024
|
+
| `active` | `boolean` | `false` | Active selection state |
|
|
1025
|
+
| `disabled` | `boolean` | `false` | Disables tab selection |
|
|
1026
|
+
|
|
1027
|
+
##### Events
|
|
1028
|
+
- `change`: Fired when active tab selection changes (`detail: { activeIndex: number }`).
|
|
1029
|
+
|
|
1030
|
+
##### Code Example
|
|
1031
|
+
```html
|
|
1032
|
+
<md-tabs active-index="0" id="demo-tab-bar">
|
|
1033
|
+
<md-tab icon="home" label="Home"></md-tab>
|
|
1034
|
+
<md-tab icon="explore" label="Explore"></md-tab>
|
|
1035
|
+
<md-tab icon="person" label="Profile"></md-tab>
|
|
1036
|
+
<md-tab icon="settings" label="Settings"></md-tab>
|
|
1037
|
+
</md-tabs>
|
|
1038
|
+
```
|
|
1039
|
+
|
|
1040
|
+
---
|
|
1041
|
+
|
|
1042
|
+
#### App Drawer (`md-app-drawer`, `md-app-drawer-item`)
|
|
1043
|
+
|
|
1044
|
+
- **Subpath**: `@francofantomius/material-components/app-drawer`
|
|
1045
|
+
- **Description**: App drawers provide a popover grid menu of applications, shortcuts, and services, typically positioned next to the account avatar or in top app bars. Includes drag-and-drop & keyboard reordering.
|
|
1046
|
+
|
|
1047
|
+
##### `<md-app-drawer>` Properties
|
|
1048
|
+
| Name | Type | Default | Description |
|
|
1049
|
+
| :--- | :--- | :--- | :--- |
|
|
1050
|
+
| `open` | `boolean` | `false` | Controls whether app drawer popover is open |
|
|
1051
|
+
| `headline` | `string` | `''` | Optional header title displayed at the top |
|
|
1052
|
+
| `icon` | `string` | `'apps'` | Material icon name for default trigger button |
|
|
1053
|
+
| `aria-label` | `string` | `'App launcher'` | Accessible label for trigger button & popover |
|
|
1054
|
+
| `trigger` | `boolean` | `true` | Whether to render built-in trigger icon button |
|
|
1055
|
+
| `alignment` | `'start' \| 'end'` | `'end'` | Horizontal alignment of popover relative to trigger |
|
|
1056
|
+
| `pivot` | `'left' \| 'right'` | `'right'` | Anchor pivot edge |
|
|
1057
|
+
| `modal` | `boolean` | `false` | Shows dimming modal backdrop when open |
|
|
1058
|
+
| `fullscreen` | `boolean` | `false` | Forces full-screen display (automatic on mobile viewports) |
|
|
1059
|
+
| `columns` | `number` | `3` | Number of columns in app grid |
|
|
1060
|
+
| `reorderable` | `boolean` | `true` | Enables drag-and-drop and keyboard reordering of apps |
|
|
1061
|
+
| `editable` | `boolean` | `true` | Shows edit icon button on top-right to toggle reordering |
|
|
1062
|
+
| `editing` | `boolean` | `false` | Controls whether app drawer is in reordering/editing mode |
|
|
1063
|
+
| `storage-key` | `string` | `''` | Custom localStorage key for persisting app order |
|
|
1064
|
+
| `disable-storage` | `boolean` | `false` | Disables automatic saving and loading of app order |
|
|
1065
|
+
|
|
1066
|
+
##### `<md-app-drawer-item>` Properties
|
|
1067
|
+
| Name | Type | Default | Description |
|
|
1068
|
+
| :--- | :--- | :--- | :--- |
|
|
1069
|
+
| `label` | `string` | `''` | Primary label for app |
|
|
1070
|
+
| `headline` | `string` | `''` | Alias for label |
|
|
1071
|
+
| `icon` | `string` | `''` | Material Symbols icon name |
|
|
1072
|
+
| `src` | `string` | `''` | Optional image or logo URL |
|
|
1073
|
+
| `badge` | `string` | `''` | Optional counter or notification badge |
|
|
1074
|
+
| `href` | `string` | `''` | Navigation URL |
|
|
1075
|
+
| `target` | `string` | `''` | Link target attribute |
|
|
1076
|
+
| `disabled` | `boolean` | `false` | Disables user interaction |
|
|
1077
|
+
| `active` | `boolean` | `false` | Active / highlighted state |
|
|
1078
|
+
|
|
1079
|
+
##### Slots
|
|
1080
|
+
- `trigger`: Custom trigger element replacing default icon button.
|
|
1081
|
+
- `back-button`: Custom back/close button element for full-screen/mobile view.
|
|
1082
|
+
- `header`: Header content above app grid.
|
|
1083
|
+
- `edit-button`: Custom edit button replacing header reorder toggle button.
|
|
1084
|
+
- `reset-button`: Custom reset button restoring default order.
|
|
1085
|
+
- `(default)`: Container for `md-app-drawer-item` elements.
|
|
1086
|
+
- `footer`: Footer content below app grid.
|
|
1087
|
+
|
|
1088
|
+
##### Events
|
|
1089
|
+
- `open`: Dispatched when app drawer opens.
|
|
1090
|
+
- `close`: Dispatched when app drawer closes.
|
|
1091
|
+
- `item-click`: Dispatched when an app item is selected.
|
|
1092
|
+
- `reorder`: Dispatched when apps are reordered.
|
|
1093
|
+
- `reset`: Dispatched when app order is reset to default.
|
|
1094
|
+
- `edit-toggle`: Dispatched when reordering edit mode is toggled.
|
|
1095
|
+
|
|
1096
|
+
##### Code Example
|
|
1097
|
+
```html
|
|
1098
|
+
<md-app-drawer id="demo-app-drawer" headline="Apps">
|
|
1099
|
+
<md-app-drawer-item icon="mail" label="Mail" badge="5"></md-app-drawer-item>
|
|
1100
|
+
<md-app-drawer-item icon="calendar_today" label="Calendar"></md-app-drawer-item>
|
|
1101
|
+
<md-app-drawer-item icon="folder" label="Drive"></md-app-drawer-item>
|
|
1102
|
+
<md-app-drawer-item icon="chat" label="Chat"></md-app-drawer-item>
|
|
1103
|
+
<md-app-drawer-item icon="videocam" label="Meet"></md-app-drawer-item>
|
|
1104
|
+
<md-app-drawer-item icon="contacts" label="Contacts"></md-app-drawer-item>
|
|
1105
|
+
<div slot="footer" style="padding: 4px 0; display: flex; justify-content: center;">
|
|
1106
|
+
<md-button variant="outlined">More apps</md-button>
|
|
1107
|
+
</div>
|
|
1108
|
+
</md-app-drawer>
|
|
1109
|
+
```
|
|
1110
|
+
|
|
1111
|
+
---
|
|
1112
|
+
|
|
1113
|
+
#### Account Menu (`md-account-menu`, `md-account-item`)
|
|
1114
|
+
|
|
1115
|
+
- **Subpath**: `@francofantomius/material-components/account-menu`
|
|
1116
|
+
- **Description**: Profile menu and account switcher that displays user credentials, role details, security status, storage quotas, and multiple account management.
|
|
1117
|
+
|
|
1118
|
+
##### `<md-account-menu>` Properties
|
|
1119
|
+
| Name | Type | Default | Description |
|
|
1120
|
+
| :--- | :--- | :--- | :--- |
|
|
1121
|
+
| `open` | `boolean` | `false` | Controls whether account menu popover is open |
|
|
1122
|
+
| `name` | `string` | `'Franco Fantomius'` | Display name of active user |
|
|
1123
|
+
| `email` | `string` | `'franco.fantomius@example.com'` | Primary email address |
|
|
1124
|
+
| `avatar` | `string` | `''` | URL to avatar image |
|
|
1125
|
+
| `initials` | `string` | `''` | Fallback initials if avatar is not set |
|
|
1126
|
+
| `headline` | `string` | `'Account'` | Header text |
|
|
1127
|
+
| `manage-text` | `string` | `'Manage your Account'` | Label for main account management button |
|
|
1128
|
+
| `manage-url` | `string` | `''` | Navigation URL for account management |
|
|
1129
|
+
| `organization` | `string` | `'Material Components'` | Company or organization name |
|
|
1130
|
+
| `role-title` | `string` | `'Lead Architect'` | User role or job title |
|
|
1131
|
+
| `status` | `string` | `'Active'` | Account status badge |
|
|
1132
|
+
| `storage-used` | `string` | `'10.4 GB'` | Storage amount currently used |
|
|
1133
|
+
| `storage-total` | `string` | `'15 GB'` | Total storage capacity |
|
|
1134
|
+
| `storage-progress` | `number` | `0.69` | Storage usage ratio between 0 and 1 |
|
|
1135
|
+
| `security-status` | `string` | `'Protected'` | Security and 2FA status |
|
|
1136
|
+
| `show-tabs` | `boolean` | `true` | Renders Overview, Security, Storage, and Accounts tabs |
|
|
1137
|
+
| `alignment` | `'start' \| 'end'` | `'end'` | Horizontal alignment of popover relative to trigger |
|
|
1138
|
+
| `pivot` | `'left' \| 'right'` | `'right'` | Anchor pivot edge |
|
|
1139
|
+
| `modal` | `boolean` | `false` | Shows dimming modal backdrop when open |
|
|
1140
|
+
| `fullscreen` | `boolean` | `false` | Forces full-screen display (automatic on mobile viewports) |
|
|
1141
|
+
|
|
1142
|
+
##### `<md-account-item>` Properties
|
|
1143
|
+
| Name | Type | Default | Description |
|
|
1144
|
+
| :--- | :--- | :--- | :--- |
|
|
1145
|
+
| `name` | `string` | `''` | Account profile name |
|
|
1146
|
+
| `email` | `string` | `''` | Account email address |
|
|
1147
|
+
| `avatar` | `string` | `''` | Avatar image URL |
|
|
1148
|
+
| `initials` | `string` | `''` | Avatar initials |
|
|
1149
|
+
| `icon` | `string` | `''` | Icon name |
|
|
1150
|
+
| `active` | `boolean` | `false` | Marks account as currently active |
|
|
1151
|
+
| `action` | `boolean` | `false` | Action item mode (e.g. Add another account) |
|
|
1152
|
+
| `disabled` | `boolean` | `false` | Disables interaction |
|
|
1153
|
+
|
|
1154
|
+
##### Slots
|
|
1155
|
+
- `trigger`: Custom trigger element replacing default avatar button.
|
|
1156
|
+
- `back-button`: Custom back/close button element for full-screen/mobile view.
|
|
1157
|
+
- `header`: Custom header content.
|
|
1158
|
+
- `overview`: Custom content for Overview tab.
|
|
1159
|
+
- `security`: Custom content for Security tab.
|
|
1160
|
+
- `storage`: Custom content for Storage tab.
|
|
1161
|
+
- `accounts`: Container for `md-account-item` instances.
|
|
1162
|
+
- `footer`: Custom footer content (e.g. Sign out action).
|
|
1163
|
+
|
|
1164
|
+
##### Events
|
|
1165
|
+
- `open`: Dispatched when account menu opens.
|
|
1166
|
+
- `close`: Dispatched when account menu closes.
|
|
1167
|
+
- `tab-change`: Dispatched when user switches tabs (`detail: { tab }`).
|
|
1168
|
+
- `account-select`: Dispatched when an account profile is chosen.
|
|
1169
|
+
- `manage-click`: Dispatched when Manage Account button is clicked.
|
|
1170
|
+
- `sign-out`: Dispatched when Sign out button is clicked.
|
|
1171
|
+
- `edit-avatar`: Dispatched when avatar photo edit button is clicked.
|
|
1172
|
+
|
|
1173
|
+
##### Code Example
|
|
1174
|
+
```html
|
|
1175
|
+
<md-account-menu
|
|
1176
|
+
id="demo-account-menu"
|
|
1177
|
+
name="Franco Fantomius"
|
|
1178
|
+
email="franco.fantomius@example.com"
|
|
1179
|
+
initials="F"
|
|
1180
|
+
role-title="Lead Architect"
|
|
1181
|
+
organization="Material Components Team"
|
|
1182
|
+
storage-used="10.4 GB"
|
|
1183
|
+
storage-total="15 GB"
|
|
1184
|
+
storage-progress="0.69"
|
|
1185
|
+
>
|
|
1186
|
+
<md-account-item
|
|
1187
|
+
slot="accounts"
|
|
1188
|
+
name="Franco Fantomius"
|
|
1189
|
+
email="franco.fantomius@example.com"
|
|
1190
|
+
initials="F"
|
|
1191
|
+
active
|
|
1192
|
+
></md-account-item>
|
|
1193
|
+
<md-account-item
|
|
1194
|
+
slot="accounts"
|
|
1195
|
+
name="Work Workspace"
|
|
1196
|
+
email="franco.dev@work.corp"
|
|
1197
|
+
initials="W"
|
|
1198
|
+
></md-account-item>
|
|
1199
|
+
<md-account-item
|
|
1200
|
+
slot="accounts"
|
|
1201
|
+
name="Add another account"
|
|
1202
|
+
icon="person_add"
|
|
1203
|
+
action
|
|
1204
|
+
></md-account-item>
|
|
1205
|
+
</md-account-menu>
|
|
1206
|
+
```
|
|
1207
|
+
|
|
1208
|
+
---
|
|
1209
|
+
|
|
1210
|
+
### Media & Playback
|
|
1211
|
+
|
|
1212
|
+
#### Player (`md-player`)
|
|
1213
|
+
|
|
1214
|
+
- **Subpath**: `@francofantomius/material-components/player`
|
|
1215
|
+
- **Description**: Material Design 3 media player component supporting audio and video playback, responsive compact and large-screen layouts, artwork/posters, interactive progress scrubbing, always-visible volume controls, queue toggle, playback rates, and keyboard shortcuts.
|
|
1216
|
+
|
|
1217
|
+
##### Properties & Attributes
|
|
1218
|
+
| Name | Type | Default | Description |
|
|
1219
|
+
| :--- | :--- | :--- | :--- |
|
|
1220
|
+
| `src` | `string` | `''` | Media source URL for audio or video playback |
|
|
1221
|
+
| `type` | `'audio' \| 'video'` | `'audio'` | Type of media to render |
|
|
1222
|
+
| `variant` | `'elevated' \| 'filled' \| 'outlined' \| 'compact' \| 'full'` | `'elevated'` | Surface container style or layout variant |
|
|
1223
|
+
| `track-title` | `string` | `''` | Title of current track or video |
|
|
1224
|
+
| `artist` | `string` | `''` | Artist or author name |
|
|
1225
|
+
| `album` | `string` | `''` | Album or series name |
|
|
1226
|
+
| `poster` | `string` | `''` | Artwork / poster image URL |
|
|
1227
|
+
| `currentTime` | `number` | `0` | Current playback position in seconds |
|
|
1228
|
+
| `duration` | `number` | `0` | Total media duration in seconds |
|
|
1229
|
+
| `volume` | `number` | `1` | Audio volume level (0.0 to 1.0) |
|
|
1230
|
+
| `muted` | `boolean` | `false` | Mutes media audio output |
|
|
1231
|
+
| `playback-rate` | `number` | `1` | Speed multiplier (0.5x to 2x) |
|
|
1232
|
+
| `paused` | `boolean` | `true` | Playback pause state |
|
|
1233
|
+
| `loop` | `boolean` | `false` | Repeats track when finished |
|
|
1234
|
+
| `autoplay` | `boolean` | `false` | Automatically begins playback on load |
|
|
1235
|
+
| `compact` | `boolean` | `false` | Forces minimal single-row bar layout |
|
|
1236
|
+
| `show-skip` | `boolean` | `true` | Shows previous and next track buttons |
|
|
1237
|
+
| `show-seek` | `boolean` | `true` | Shows rewind and fast-forward 10s buttons |
|
|
1238
|
+
| `show-volume` | `boolean` | `true` | Shows always-visible volume button and slider |
|
|
1239
|
+
| `show-playback-rate` | `boolean` | `true` | Shows playback rate cycle button |
|
|
1240
|
+
| `show-queue` | `boolean` | `true` | Shows music queue toggle button |
|
|
1241
|
+
| `seek-step` | `number` | `10` | Seconds to skip with rewind/forward controls |
|
|
1242
|
+
|
|
1243
|
+
##### Slots
|
|
1244
|
+
- `media`: Custom native `<audio>` or `<video>` element.
|
|
1245
|
+
- `artwork`: Custom album artwork or video thumbnail element.
|
|
1246
|
+
- `title`: Custom title header content.
|
|
1247
|
+
- `artist`: Custom artist or subtitle content.
|
|
1248
|
+
- `actions`: Custom action buttons (like, share, playlist).
|
|
1249
|
+
- `(default)`: Additional content below controls (lyrics, playlist).
|
|
1250
|
+
|
|
1251
|
+
##### Events
|
|
1252
|
+
- `play`: Fired when playback begins.
|
|
1253
|
+
- `pause`: Fired when playback is paused.
|
|
1254
|
+
- `timeupdate`: Fired periodically as time updates (`detail: { currentTime: number, duration: number, progress: number }`).
|
|
1255
|
+
- `seeked`: Fired after seeking (`detail: { currentTime: number }`).
|
|
1256
|
+
- `volumechange`: Fired when volume or mute changes (`detail: { volume: number, muted: boolean }`).
|
|
1257
|
+
- `ratechange`: Fired when playback rate is modified (`detail: { playbackRate: number }`).
|
|
1258
|
+
- `queue`: Fired when queue button is toggled (`detail: { open: boolean }`).
|
|
1259
|
+
- `previous`: Fired on previous button click.
|
|
1260
|
+
- `next`: Fired on next button click.
|
|
1261
|
+
- `ended`: Fired when media playback ends.
|
|
1262
|
+
- `fullscreenchange`: Fired when fullscreen state changes in video mode (`detail: { fullscreen: boolean }`).
|
|
1263
|
+
|
|
1264
|
+
##### JavaScript API Methods
|
|
1265
|
+
- `play()`: Begins or resumes playback.
|
|
1266
|
+
- `pause()`: Pauses active playback.
|
|
1267
|
+
- `togglePlay()`: Toggles between play and pause.
|
|
1268
|
+
- `seek(timeInSeconds)`: Jumps directly to timestamp.
|
|
1269
|
+
- `seekBy(deltaSeconds)`: Relative seek forward/backward.
|
|
1270
|
+
- `setVolume(level)`: Sets volume (0.0 to 1.0).
|
|
1271
|
+
- `toggleMute()`: Toggles audio mute state.
|
|
1272
|
+
- `toggleQueue()`: Toggles music queue state.
|
|
1273
|
+
- `cyclePlaybackRate()`: Cycles speed rates (0.5x, 0.75x, 1x, 1.25x, 1.5x, 2x).
|
|
1274
|
+
- `toggleFullscreen()`: Toggles fullscreen video mode.
|
|
1275
|
+
|
|
1276
|
+
##### Code Example
|
|
1277
|
+
```html
|
|
1278
|
+
<!-- Full Audio Player -->
|
|
1279
|
+
<md-player
|
|
1280
|
+
track-title="Midnight City Dreams"
|
|
1281
|
+
artist="Synthetic Horizons"
|
|
1282
|
+
album="Future Echoes (2026)"
|
|
1283
|
+
poster="https://picsum.photos/seed/music/300/300"
|
|
1284
|
+
duration="214"
|
|
1285
|
+
current-time="45"
|
|
1286
|
+
></md-player>
|
|
1287
|
+
|
|
1288
|
+
<!-- Compact Bar Player -->
|
|
1289
|
+
<md-player
|
|
1290
|
+
compact
|
|
1291
|
+
variant="outlined"
|
|
1292
|
+
track-title="Episode 42: Modern Web Design"
|
|
1293
|
+
artist="Tech Talk Daily"
|
|
1294
|
+
poster="https://picsum.photos/seed/podcast/200/200"
|
|
1295
|
+
duration="1820"
|
|
1296
|
+
></md-player>
|
|
1297
|
+
|
|
1298
|
+
<!-- Video Player Mode -->
|
|
1299
|
+
<md-player
|
|
1300
|
+
type="video"
|
|
1301
|
+
src="https://example.com/sample.mp4"
|
|
1302
|
+
track-title="Material Design 3 Interactive Experience"
|
|
1303
|
+
poster="https://picsum.photos/seed/video/800/450"
|
|
1304
|
+
></md-player>
|
|
1305
|
+
```
|
|
1306
|
+
|
|
1307
|
+
---
|
|
1308
|
+
|
|
1309
|
+
### Utilities & Data
|
|
1310
|
+
|
|
1311
|
+
#### Icon (`md-icon`)
|
|
1312
|
+
|
|
1313
|
+
- **Subpath**: `@francofantomius/material-components/icon`
|
|
1314
|
+
- **Description**: Icons visually communicate meaning, actions, and status using Google Material Symbols variable font glyphs or custom slotted SVGs.
|
|
1315
|
+
|
|
1316
|
+
##### Properties & Attributes
|
|
1317
|
+
| Name | Type | Default | Description |
|
|
1318
|
+
| :--- | :--- | :--- | :--- |
|
|
1319
|
+
| `name` | `string` | `''` | Material Symbols font glyph identifier |
|
|
1320
|
+
| `filled` | `boolean` | `false` | Enables filled variation in variable font |
|
|
1321
|
+
| `size` | `string` | `''` | Custom CSS font size (e.g. `32`, `2rem`) |
|
|
1322
|
+
|
|
1323
|
+
##### Code Example
|
|
1324
|
+
```html
|
|
1325
|
+
<md-icon name="favorite"></md-icon>
|
|
1326
|
+
<md-icon name="favorite" filled style="color: var(--md-sys-color-error);"></md-icon>
|
|
1327
|
+
<md-icon name="settings" size="32"></md-icon>
|
|
1328
|
+
<md-icon name="rocket_launch" size="48" style="color: var(--md-sys-color-primary);"></md-icon>
|
|
1329
|
+
```
|
|
1330
|
+
|
|
1331
|
+
---
|
|
1332
|
+
|
|
1333
|
+
#### Code Block & Highlighter (`md-code`)
|
|
1334
|
+
|
|
1335
|
+
- **Subpath**: `@francofantomius/material-components/code`
|
|
1336
|
+
- **Description**: Code component with syntax highlighting for popular languages, real-time multi-language linting diagnostics, line numbers, line highlighting, and one-click copy to clipboard.
|
|
1337
|
+
|
|
1338
|
+
##### Properties & Attributes
|
|
1339
|
+
| Name | Type | Default | Description |
|
|
1340
|
+
| :--- | :--- | :--- | :--- |
|
|
1341
|
+
| `code` | `string` | `''` | Source code content string (falls back to slot/textContent) |
|
|
1342
|
+
| `language` / `lang` | `string` | `'plaintext'` | Syntax language: `javascript`, `typescript`, `html`, `css`, `json`, `python`, `bash`, `sql`, `yaml`, `markdown` |
|
|
1343
|
+
| `label` / `filename` | `string` | `''` | Header label or filename (e.g. `"button.ts"`, `"package.json"`) |
|
|
1344
|
+
| `lint` | `boolean` | `false` | Enables built-in real-time multi-language syntax linting |
|
|
1345
|
+
| `diagnostics` | `LintDiagnostic[]` | `[]` | Array of custom diagnostic issues to display (`{ line, column, message, severity, rule }`) |
|
|
1346
|
+
| `show-lint-summary` | `boolean` | `true` | Whether to show the collapsible lint issues summary footer bar |
|
|
1347
|
+
| `line-numbers` | `boolean` | `false` | Renders line numbers gutter |
|
|
1348
|
+
| `highlight-lines` | `string` | `''` | Comma-separated line numbers or ranges to highlight (e.g. `"1, 3-5, 8"`) |
|
|
1349
|
+
| `copyable` | `boolean` | `true` | Enables clipboard copying functionality |
|
|
1350
|
+
| `hide-copy-button` | `boolean` | `false` | Hides the copy button from the header |
|
|
1351
|
+
| `wrap-lines` | `boolean` | `false` | Wraps long lines instead of horizontal scrolling |
|
|
1352
|
+
| `max-height` | `string` | `''` | Maximum height of code scroll area (e.g. `"300px"`) |
|
|
1353
|
+
|
|
1354
|
+
##### Slots
|
|
1355
|
+
- `(default)`: Source code text when `code` property is omitted.
|
|
1356
|
+
- `actions`: Additional action buttons placed in header bar.
|
|
1357
|
+
|
|
1358
|
+
##### Events
|
|
1359
|
+
- `copy`: Fired when code is copied to clipboard (`detail: { code: string }`).
|
|
1360
|
+
- `lint-complete`: Fired after linting finishes (`detail: { diagnostics: LintDiagnostic[], isValid: boolean }`).
|
|
1361
|
+
|
|
1362
|
+
##### CSS Variables
|
|
1363
|
+
| Variable | Default | Description |
|
|
1364
|
+
| :--- | :--- | :--- |
|
|
1365
|
+
| `--md-code-bg` | `var(--md-sys-color-surface-container)` | Background color of code block |
|
|
1366
|
+
| `--md-code-header-bg` | `var(--md-sys-color-surface-container-high)` | Background color of header bar |
|
|
1367
|
+
| `--md-code-border` | `var(--md-sys-color-outline-variant)` | Border color of container |
|
|
1368
|
+
| `--md-code-color` | `var(--md-sys-color-on-surface)` | Default text color of code tokens |
|
|
1369
|
+
| `--md-code-gutter-color` | `var(--md-sys-color-outline)` | Text color of line numbers |
|
|
1370
|
+
| `--md-code-radius` | `var(--md-sys-shape-corner-medium, 12px)` | Corner border radius |
|
|
1371
|
+
| `--md-code-font-size` | `13.5px` | Font size of the code |
|
|
1372
|
+
| `--md-code-line-height` | `1.6` | Line height multiplier |
|
|
1373
|
+
|
|
1374
|
+
##### Code Example
|
|
1375
|
+
```html
|
|
1376
|
+
<md-code
|
|
1377
|
+
language="typescript"
|
|
1378
|
+
label="src/index.ts"
|
|
1379
|
+
line-numbers
|
|
1380
|
+
highlight-lines="4, 7-9"
|
|
1381
|
+
>
|
|
1382
|
+
import { LitElement, html, css } from 'lit';
|
|
1383
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
1384
|
+
|
|
1385
|
+
@customElement('my-counter')
|
|
1386
|
+
export class MyCounter extends LitElement {
|
|
1387
|
+
@property({ type: Number }) count = 0;
|
|
1388
|
+
|
|
1389
|
+
private increment() {
|
|
1390
|
+
this.count += 1;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
render() {
|
|
1394
|
+
return html`<button @click=${this.increment}>Count: ${this.count}</button>`;
|
|
1395
|
+
}
|
|
1396
|
+
}
|
|
1397
|
+
</md-code>
|
|
1398
|
+
|
|
1399
|
+
<!-- Real-time Linting -->
|
|
1400
|
+
<md-code language="json" label="package.json" line-numbers lint>
|
|
1401
|
+
{
|
|
1402
|
+
"name": "@francofantomius/material-components",
|
|
1403
|
+
"version": "1.0.0"
|
|
1404
|
+
}
|
|
1405
|
+
</md-code>
|
|
1406
|
+
```
|
|
1407
|
+
|