@amedia/brick-mcp 0.0.1-LLM-DOCS → 0.0.1-NEW-PATH-1
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/README.md +241 -98
- package/dist/data/components/brick-actions.json +6 -0
- package/dist/data/components/brick-alt-teaser.json +10 -0
- package/dist/data/components/brick-avatar.json +11 -0
- package/dist/data/components/brick-button.json +12 -0
- package/dist/data/components/brick-card.json +10 -0
- package/dist/data/components/brick-carousel.json +11 -0
- package/dist/data/components/brick-classnames.json +10 -0
- package/dist/data/components/brick-countdown.json +7 -0
- package/dist/data/components/brick-dialog.json +11 -0
- package/dist/data/components/brick-fonts.json +10 -0
- package/dist/data/components/brick-helloworld.json +7 -0
- package/dist/data/components/brick-icon.json +10 -0
- package/dist/data/components/brick-icons.json +11 -0
- package/dist/data/components/brick-illustrations.json +7 -0
- package/dist/data/components/brick-image.json +10 -0
- package/dist/data/components/brick-input.json +12 -0
- package/{data → dist/data}/components/brick-mcp.json +1 -1
- package/dist/data/components/brick-nifs.json +7 -0
- package/{data → dist/data}/components/brick-pill.json +1 -1
- package/{data → dist/data}/components/brick-player.json +1 -1
- package/dist/data/components/brick-published.json +7 -0
- package/{data → dist/data}/components/brick-share.json +1 -1
- package/{data → dist/data}/components/brick-stepper.json +1 -1
- package/{data → dist/data}/components/brick-tab.json +1 -1
- package/{data → dist/data}/components/brick-tabs.json +1 -1
- package/{data → dist/data}/components/brick-tag.json +1 -1
- package/{data → dist/data}/components/brick-teaser-player.json +1 -1
- package/{data → dist/data}/components/brick-teaser-reels.json +1 -1
- package/{data → dist/data}/components/brick-teaser.json +1 -1
- package/{data → dist/data}/components/brick-textarea.json +1 -1
- package/{data → dist/data}/components/brick-toast.json +1 -1
- package/{data → dist/data}/components/brick-toggle.json +1 -1
- package/{data → dist/data}/components/brick-tokens.json +1 -1
- package/{data → dist/data}/components/brick-tooltip.json +1 -1
- package/{data → dist/data}/components-metadata.json +29 -29
- package/dist/data/components.json +321 -0
- package/dist/http.js +311 -0
- package/dist/http.js.map +7 -0
- package/dist/index.js +52 -81
- package/dist/index.js.map +4 -4
- package/package.json +3 -6
- package/scripts/generate-data.js +37 -40
- package/data/components/brick-actions.md +0 -59
- package/data/components/brick-alt-teaser.md +0 -253
- package/data/components/brick-avatar.md +0 -265
- package/data/components/brick-button.md +0 -364
- package/data/components/brick-card.md +0 -329
- package/data/components/brick-carousel.md +0 -330
- package/data/components/brick-classnames.md +0 -150
- package/data/components/brick-countdown.md +0 -179
- package/data/components/brick-dialog.md +0 -418
- package/data/components/brick-fonts.md +0 -335
- package/data/components/brick-helloworld.md +0 -202
- package/data/components/brick-icon.md +0 -271
- package/data/components/brick-icons.md +0 -430
- package/data/components/brick-illustrations.md +0 -552
- package/data/components/brick-image.md +0 -335
- package/data/components/brick-input.md +0 -521
- package/data/components/brick-nifs.md +0 -163
- package/data/components/brick-published.json +0 -7
- package/data/tokens-documentation.json +0 -7
- /package/{data → dist/data}/components/brick-template.json +0 -0
- /package/{data → dist/data}/components/brick-themes.json +0 -0
- /package/{data → dist/data}/tokens.json +0 -0
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: brick-avatar
|
|
3
|
-
version: 0.2.36
|
|
4
|
-
selector: brick-avatar-v0
|
|
5
|
-
category: Media
|
|
6
|
-
tags: [avatar, profile, user, image, initials, icon, identity, media]
|
|
7
|
-
use_cases: [user-profiles, author-bylines, comment-sections, team-rosters, sports-teams, contact-lists, chat-interfaces, social-features]
|
|
8
|
-
related: [brick-image, brick-tokens]
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Brick Avatar
|
|
12
|
-
|
|
13
|
-
A visual component representing a person, object, or entity through an image, icon, or initials.
|
|
14
|
-
|
|
15
|
-
## Key Capabilities
|
|
16
|
-
|
|
17
|
-
- Display user profile images with automatic fallback to initials
|
|
18
|
-
- Support for multiple sizes (small, medium, large) and shapes (default theme, circle)
|
|
19
|
-
- Decorative letter shapes for sports teams and organizations (shield, t-shirt)
|
|
20
|
-
- Custom CSS property support for SVG backgrounds
|
|
21
|
-
- Accessible implementation with proper alt text handling
|
|
22
|
-
- Server-side rendering support for optimal performance
|
|
23
|
-
|
|
24
|
-
## Props/Attributes
|
|
25
|
-
|
|
26
|
-
| Attribute | Type | Default | Required | Description |
|
|
27
|
-
|-----------|------|---------|----------|-------------|
|
|
28
|
-
| `data-img` | string | "" | no | URL for the avatar image. Preferably a square image (cropped from top if not square) |
|
|
29
|
-
| `data-letters` | string | "" | no | One or two letter string used as initials when image is not provided or fails to load |
|
|
30
|
-
| `data-alt` | string | "" | no | Alternative text for images or screen reader text for letter avatars. Empty string hides decorative avatars from assistive technology |
|
|
31
|
-
| `data-size` | "small" \| "medium" \| "large" | "medium" | no | Controls the size of the avatar using design tokens |
|
|
32
|
-
| `data-shape` | "circle" \| "" | "" | no | Sets the avatar shape. Empty string uses theme default avatar shape |
|
|
33
|
-
| `data-letters-shape` | "shield" \| "tshirt" \| "" | "" | no | Adds a background shape behind letters. Only applies when using `data-letters`, not with `data-img` |
|
|
34
|
-
|
|
35
|
-
## Examples
|
|
36
|
-
|
|
37
|
-
### Basic Avatar with Initials
|
|
38
|
-
Display user initials as a fallback or primary identifier.
|
|
39
|
-
|
|
40
|
-
```html
|
|
41
|
-
<brick-avatar-v0
|
|
42
|
-
data-letters="AM"
|
|
43
|
-
data-alt="Initials for Amedia"
|
|
44
|
-
data-size="medium">
|
|
45
|
-
</brick-avatar-v0>
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
### Avatar with Image
|
|
49
|
-
Show a profile photo with automatic fallback to initials if image fails.
|
|
50
|
-
|
|
51
|
-
```html
|
|
52
|
-
<brick-avatar-v0
|
|
53
|
-
data-img="https://example.com/profile-photo.jpg"
|
|
54
|
-
data-alt="Profile picture of John Doe"
|
|
55
|
-
data-letters="JD"
|
|
56
|
-
data-size="large">
|
|
57
|
-
</brick-avatar-v0>
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Circle Avatar for User Profiles
|
|
61
|
-
Use circle shape for a softer, more personal feel in user interfaces.
|
|
62
|
-
|
|
63
|
-
```html
|
|
64
|
-
<brick-avatar-v0
|
|
65
|
-
data-img="https://example.com/user-avatar.jpg"
|
|
66
|
-
data-alt="User profile picture"
|
|
67
|
-
data-shape="circle"
|
|
68
|
-
data-size="medium">
|
|
69
|
-
</brick-avatar-v0>
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
### Sports Team Avatar with Shield
|
|
73
|
-
Display team initials with a shield background, commonly used in sports applications.
|
|
74
|
-
|
|
75
|
-
```html
|
|
76
|
-
<brick-avatar-v0
|
|
77
|
-
data-letters="BSK"
|
|
78
|
-
data-alt="Bærum Sportsklubb team logo"
|
|
79
|
-
data-letters-shape="shield"
|
|
80
|
-
data-size="medium"
|
|
81
|
-
style="--b-avatar-color-fg:var(--brick-colors-supportiveSportFg);
|
|
82
|
-
--b-avatar-color-border:var(--brick-colors-supportiveSportBg);
|
|
83
|
-
--b-avatar-color-shape:var(--brick-colors-supportiveSportBg);">
|
|
84
|
-
</brick-avatar-v0>
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
### Team Avatar with T-Shirt Shape
|
|
88
|
-
Use t-shirt shape for team jerseys or sports team identification.
|
|
89
|
-
|
|
90
|
-
```html
|
|
91
|
-
<brick-avatar-v0
|
|
92
|
-
data-letters="T"
|
|
93
|
-
data-alt="Team T jersey"
|
|
94
|
-
data-letters-shape="tshirt"
|
|
95
|
-
data-size="large"
|
|
96
|
-
style="--b-avatar-color-fg:var(--brick-colors-supportiveSportFg);
|
|
97
|
-
--b-avatar-color-shape:red;">
|
|
98
|
-
</brick-avatar-v0>
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
### Avatar with SVG Background
|
|
102
|
-
Set a custom SVG as the avatar background using CSS custom property.
|
|
103
|
-
|
|
104
|
-
```html
|
|
105
|
-
<brick-avatar-v0
|
|
106
|
-
data-alt="Organization logo"
|
|
107
|
-
data-size="small"
|
|
108
|
-
style="--b-avatar-borderWidth:0;
|
|
109
|
-
--b-avatar-svg:url('https://example.com/logo.svg')">
|
|
110
|
-
</brick-avatar-v0>
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### Decorative Avatar (No Alt Text)
|
|
114
|
-
For purely decorative avatars where information is conveyed elsewhere, omit `data-alt` for accessibility.
|
|
115
|
-
|
|
116
|
-
```html
|
|
117
|
-
<brick-avatar-v0
|
|
118
|
-
data-img="https://example.com/decorative-icon.jpg"
|
|
119
|
-
data-size="small">
|
|
120
|
-
</brick-avatar-v0>
|
|
121
|
-
```
|
|
122
|
-
|
|
123
|
-
## Server-Side Rendering
|
|
124
|
-
|
|
125
|
-
### Render Function
|
|
126
|
-
Use the template function for optimal server-side rendering performance.
|
|
127
|
-
|
|
128
|
-
```javascript
|
|
129
|
-
import { renderBrickAvatar } from '@amedia/brick-avatar/template';
|
|
130
|
-
|
|
131
|
-
const markup = renderBrickAvatar({
|
|
132
|
-
dataLetters: 'KN',
|
|
133
|
-
dataAlttext: 'Initials for Kari Nordmann',
|
|
134
|
-
dataSize: 'medium'
|
|
135
|
-
});
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
### Client-Side Import
|
|
139
|
-
Import the web component definition for client-side hydration and interactivity.
|
|
140
|
-
|
|
141
|
-
```javascript
|
|
142
|
-
import '@amedia/brick-avatar';
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
## CSS Custom Properties
|
|
146
|
-
|
|
147
|
-
Customize the avatar appearance using CSS custom properties. Always scope your overrides and ensure WCAG 2.1 AA compliance.
|
|
148
|
-
|
|
149
|
-
| Property | Description | Default |
|
|
150
|
-
|----------|-------------|---------|
|
|
151
|
-
| `--b-avatar-svg` | Set the background SVG image using `url()` notation | None |
|
|
152
|
-
| `--b-avatar-size` | Controls the size (prefer using `data-size` attribute) | `var(--brick-sizes-avatarM)` |
|
|
153
|
-
| `--b-avatar-color-bg` | Background color for letter avatars | `var(--brick-colors-baseNeutral00)` |
|
|
154
|
-
| `--b-avatar-color-fg` | Text color for letter avatars | `var(--brick-colors-baseFg)` |
|
|
155
|
-
| `--b-avatar-color-border` | Border color | `var(--brick-colors-baseNeutral00)` |
|
|
156
|
-
| `--b-avatar-color-shape` | Background color for letter shapes (shield, t-shirt) | `transparent` |
|
|
157
|
-
| `--b-avatar-borderWidth` | Border width | `var(--brick-borderWidths-baseS)` |
|
|
158
|
-
| `--b-avatar-padding` | Internal padding | `0` |
|
|
159
|
-
|
|
160
|
-
### Custom Styling Example
|
|
161
|
-
```html
|
|
162
|
-
<brick-avatar-v0
|
|
163
|
-
data-img="https://api.nifs.no/images/teams/logo/8/"
|
|
164
|
-
data-size="large"
|
|
165
|
-
style="--b-avatar-padding:10px;
|
|
166
|
-
--b-avatar-size:120px;
|
|
167
|
-
--b-avatar-color-bg:var(--brick-colors-supportiveSportBg);
|
|
168
|
-
--b-avatar-color-fg:var(--brick-colors-supportiveSportFg);
|
|
169
|
-
--b-avatar-color-border:transparent;">
|
|
170
|
-
</brick-avatar-v0>
|
|
171
|
-
```
|
|
172
|
-
|
|
173
|
-
## Accessibility
|
|
174
|
-
|
|
175
|
-
### Image Avatars
|
|
176
|
-
- Always provide `data-alt` for informative images describing the person or entity
|
|
177
|
-
- Omit `data-alt` for purely decorative avatars (automatically gets empty alt attribute)
|
|
178
|
-
- Screen readers will ignore decorative images with empty alt text
|
|
179
|
-
|
|
180
|
-
### Letter Avatars
|
|
181
|
-
- The `data-alt` property creates a visually hidden element for screen readers
|
|
182
|
-
- Provides context for abbreviated initials (e.g., "KN" becomes "Initials for Kari Nordmann")
|
|
183
|
-
- Ensures users with assistive technology understand the meaning of the letters
|
|
184
|
-
|
|
185
|
-
### Keyboard Navigation
|
|
186
|
-
- Avatar component is non-interactive by default
|
|
187
|
-
- If wrapped in an interactive element (button, link), ensure proper focus states
|
|
188
|
-
|
|
189
|
-
## Common Patterns
|
|
190
|
-
|
|
191
|
-
### Author Byline
|
|
192
|
-
Display author information in article headers or comments.
|
|
193
|
-
|
|
194
|
-
```html
|
|
195
|
-
<div class="author-byline">
|
|
196
|
-
<brick-avatar-v0
|
|
197
|
-
data-img="https://example.com/author.jpg"
|
|
198
|
-
data-alt="Photo of Jane Smith"
|
|
199
|
-
data-letters="JS"
|
|
200
|
-
data-size="small"
|
|
201
|
-
data-shape="circle">
|
|
202
|
-
</brick-avatar-v0>
|
|
203
|
-
<span class="author-name">Jane Smith</span>
|
|
204
|
-
</div>
|
|
205
|
-
```
|
|
206
|
-
|
|
207
|
-
### User List
|
|
208
|
-
Show multiple users in a team or contact list.
|
|
209
|
-
|
|
210
|
-
```html
|
|
211
|
-
<ul class="user-list">
|
|
212
|
-
<li>
|
|
213
|
-
<brick-avatar-v0
|
|
214
|
-
data-letters="AM"
|
|
215
|
-
data-alt="Amedia"
|
|
216
|
-
data-size="medium">
|
|
217
|
-
</brick-avatar-v0>
|
|
218
|
-
<span>Amedia</span>
|
|
219
|
-
</li>
|
|
220
|
-
<li>
|
|
221
|
-
<brick-avatar-v0
|
|
222
|
-
data-letters="KN"
|
|
223
|
-
data-alt="Kari Nordmann"
|
|
224
|
-
data-size="medium">
|
|
225
|
-
</brick-avatar-v0>
|
|
226
|
-
<span>Kari Nordmann</span>
|
|
227
|
-
</li>
|
|
228
|
-
</ul>
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
### Sports Team Roster
|
|
232
|
-
Display team members with jersey-style avatars.
|
|
233
|
-
|
|
234
|
-
```html
|
|
235
|
-
<div class="team-roster">
|
|
236
|
-
<brick-avatar-v0
|
|
237
|
-
data-letters="10"
|
|
238
|
-
data-alt="Player number 10"
|
|
239
|
-
data-letters-shape="tshirt"
|
|
240
|
-
data-size="large"
|
|
241
|
-
style="--b-avatar-color-shape:#003366;
|
|
242
|
-
--b-avatar-color-fg:#ffffff;">
|
|
243
|
-
</brick-avatar-v0>
|
|
244
|
-
</div>
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
## Technical Details
|
|
248
|
-
|
|
249
|
-
- **Custom Element**: `brick-avatar-v0`
|
|
250
|
-
- **Base Class**: BrickElement (from @amedia/brick-template)
|
|
251
|
-
- **Dependencies**: @amedia/brick-tokens, @amedia/brick-image
|
|
252
|
-
- **Renders as**: Custom element with internal image or text content
|
|
253
|
-
- **Browser Support**: All modern browsers supporting Custom Elements v1
|
|
254
|
-
|
|
255
|
-
## Important Notes
|
|
256
|
-
|
|
257
|
-
- Images should preferably be square for best results; non-square images are cropped from the top
|
|
258
|
-
- The `data-letters-shape` attribute only works with letter avatars, not image avatars
|
|
259
|
-
- Custom CSS properties override default theme values; ensure color contrast meets WCAG 2.1 AA standards
|
|
260
|
-
- When using `--b-avatar-svg`, the image is set as a background and will not have alt text for accessibility
|
|
261
|
-
- Server-side rendering is recommended for optimal performance and SEO
|
|
262
|
-
|
|
263
|
-
## Version
|
|
264
|
-
|
|
265
|
-
Current version: 0.2.36
|
|
@@ -1,364 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: brick-button
|
|
3
|
-
version: 9.3.1
|
|
4
|
-
selector: brick-button-v9
|
|
5
|
-
category: Forms
|
|
6
|
-
tags: [button, cta, action, interactive, link, form-control]
|
|
7
|
-
use_cases: [forms, call-to-action, navigation, user-interaction, authentication, checkout, product-listing, modal-triggers]
|
|
8
|
-
related: [brick-icon, brick-tokens]
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Brick Button
|
|
12
|
-
|
|
13
|
-
A customizable, accessible button component that supports multiple visual variants, sizes, and can render as either a button or link element.
|
|
14
|
-
|
|
15
|
-
## Key Capabilities
|
|
16
|
-
|
|
17
|
-
- Three visual variants: primary, secondary, and outlined
|
|
18
|
-
- Renders as `<button>` or `<a>` based on presence of `data-linkto` attribute
|
|
19
|
-
- Two size options: small and medium
|
|
20
|
-
- Icon support with configurable placement (left, right, top)
|
|
21
|
-
- Full ARIA attribute support for accessibility
|
|
22
|
-
- CSS custom properties for styling customization
|
|
23
|
-
- Analytics integration via ADP attributes
|
|
24
|
-
- Framework-agnostic web component with SSR support
|
|
25
|
-
|
|
26
|
-
## Props/Attributes
|
|
27
|
-
|
|
28
|
-
| Attribute | Type | Default | Required | Description |
|
|
29
|
-
|-----------|------|---------|----------|-------------|
|
|
30
|
-
| `data-label` | string | - | yes | Button text/label |
|
|
31
|
-
| `data-version` | `'primary' \| 'secondary' \| 'outlined'` | `'primary'` | no | Visual style variant |
|
|
32
|
-
| `data-size` | `'small' \| 'medium'` | `'medium'` | no | Button size |
|
|
33
|
-
| `data-linkto` | string | - | no | URL to navigate to. When set, renders as `<a>` tag |
|
|
34
|
-
| `data-target` | string | - | no | Link target (e.g., `_blank` for new tab) |
|
|
35
|
-
| `data-icon-id` | string | - | no | ID of icon from brick-icon to display |
|
|
36
|
-
| `data-iconplacement` | `'top' \| 'right' \| 'left'` | `'left'` | no | Position of icon relative to label |
|
|
37
|
-
| `data-icontext` | string | - | no | Alternative text for icon |
|
|
38
|
-
| `data-disabled` | string | - | no | Disables the button when set to "true" |
|
|
39
|
-
| `data-as` | `'span' \| 'div'` | - | no | Renders as non-interactive element (for use with framework routers) |
|
|
40
|
-
| `data-adplabel` | string | - | no | ADP analytics click label |
|
|
41
|
-
| `data-adpvalue` | string | - | no | ADP analytics click value |
|
|
42
|
-
| `data-aria-label` | string | - | no | ARIA label for accessibility |
|
|
43
|
-
| `data-aria-labelledby` | string | - | no | ID of element that labels this button |
|
|
44
|
-
| `data-aria-describedby` | string | - | no | ID of element that describes this button |
|
|
45
|
-
| `data-aria-controls` | string | - | no | ID of element controlled by this button |
|
|
46
|
-
| `data-aria-expanded` | string | - | no | Indicates if controlled element is expanded |
|
|
47
|
-
| `data-aria-pressed` | string | - | no | Indicates pressed state for toggle buttons |
|
|
48
|
-
|
|
49
|
-
## Examples
|
|
50
|
-
|
|
51
|
-
### Basic Button
|
|
52
|
-
|
|
53
|
-
```html
|
|
54
|
-
<brick-button-v9
|
|
55
|
-
data-label="Click me"
|
|
56
|
-
data-version="primary">
|
|
57
|
-
</brick-button-v9>
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Button Variants
|
|
61
|
-
|
|
62
|
-
```html
|
|
63
|
-
<!-- Primary button -->
|
|
64
|
-
<brick-button-v9
|
|
65
|
-
data-label="Primary Action"
|
|
66
|
-
data-version="primary">
|
|
67
|
-
</brick-button-v9>
|
|
68
|
-
|
|
69
|
-
<!-- Secondary button -->
|
|
70
|
-
<brick-button-v9
|
|
71
|
-
data-label="Secondary Action"
|
|
72
|
-
data-version="secondary">
|
|
73
|
-
</brick-button-v9>
|
|
74
|
-
|
|
75
|
-
<!-- Outlined button -->
|
|
76
|
-
<brick-button-v9
|
|
77
|
-
data-label="Outlined Action"
|
|
78
|
-
data-version="outlined">
|
|
79
|
-
</brick-button-v9>
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
### Button as Link
|
|
83
|
-
|
|
84
|
-
```html
|
|
85
|
-
<brick-button-v9
|
|
86
|
-
data-label="Visit Amedia"
|
|
87
|
-
data-version="primary"
|
|
88
|
-
data-linkto="https://www.amedia.no"
|
|
89
|
-
data-target="_blank">
|
|
90
|
-
</brick-button-v9>
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
### Button with Icon
|
|
94
|
-
|
|
95
|
-
```html
|
|
96
|
-
<brick-button-v9
|
|
97
|
-
data-label="Search"
|
|
98
|
-
data-version="primary"
|
|
99
|
-
data-icon-id="search"
|
|
100
|
-
data-iconplacement="left">
|
|
101
|
-
</brick-button-v9>
|
|
102
|
-
|
|
103
|
-
<!-- Icon-only button -->
|
|
104
|
-
<brick-button-v9
|
|
105
|
-
data-icon-id="menu"
|
|
106
|
-
data-aria-label="Open menu">
|
|
107
|
-
</brick-button-v9>
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Small Button
|
|
111
|
-
|
|
112
|
-
```html
|
|
113
|
-
<brick-button-v9
|
|
114
|
-
data-label="Small Action"
|
|
115
|
-
data-version="secondary"
|
|
116
|
-
data-size="small">
|
|
117
|
-
</brick-button-v9>
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
### Disabled Button
|
|
121
|
-
|
|
122
|
-
```html
|
|
123
|
-
<brick-button-v9
|
|
124
|
-
data-label="Disabled"
|
|
125
|
-
data-version="primary"
|
|
126
|
-
data-disabled="true">
|
|
127
|
-
</brick-button-v9>
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
## Framework Integration
|
|
131
|
-
|
|
132
|
-
### Svelte
|
|
133
|
-
|
|
134
|
-
```svelte
|
|
135
|
-
<script>
|
|
136
|
-
import '@amedia/brick-button';
|
|
137
|
-
|
|
138
|
-
function handleClick() {
|
|
139
|
-
console.log('Button clicked!');
|
|
140
|
-
}
|
|
141
|
-
</script>
|
|
142
|
-
|
|
143
|
-
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
|
144
|
-
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
145
|
-
<brick-button-v9
|
|
146
|
-
data-label="Click me"
|
|
147
|
-
data-version="primary"
|
|
148
|
-
onclick={handleClick}
|
|
149
|
-
/>
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
### Using with Framework Routers
|
|
153
|
-
|
|
154
|
-
When using with framework routers (like svelte-routing), use `data-as` to render as a non-interactive element:
|
|
155
|
-
|
|
156
|
-
```svelte
|
|
157
|
-
<script>
|
|
158
|
-
import { Link } from 'svelte-routing';
|
|
159
|
-
</script>
|
|
160
|
-
|
|
161
|
-
<Link to="/offers">
|
|
162
|
-
<brick-button-v9
|
|
163
|
-
data-label="See other subscriptions"
|
|
164
|
-
data-version="outlined"
|
|
165
|
-
data-as="span"
|
|
166
|
-
/>
|
|
167
|
-
</Link>
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### React/Vue
|
|
171
|
-
|
|
172
|
-
```javascript
|
|
173
|
-
import '@amedia/brick-button';
|
|
174
|
-
|
|
175
|
-
// React
|
|
176
|
-
function MyComponent() {
|
|
177
|
-
return (
|
|
178
|
-
<brick-button-v9
|
|
179
|
-
data-label="Click me"
|
|
180
|
-
data-version="primary"
|
|
181
|
-
onClick={() => console.log('clicked')}
|
|
182
|
-
/>
|
|
183
|
-
);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
// Vue
|
|
187
|
-
<template>
|
|
188
|
-
<brick-button-v9
|
|
189
|
-
data-label="Click me"
|
|
190
|
-
data-version="primary"
|
|
191
|
-
@click="handleClick"
|
|
192
|
-
/>
|
|
193
|
-
</template>
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
## Programmatic Usage
|
|
197
|
-
|
|
198
|
-
```javascript
|
|
199
|
-
import { BrickButton } from '@amedia/brick-button';
|
|
200
|
-
|
|
201
|
-
const button = new BrickButton({
|
|
202
|
-
dataLabel: 'My Button',
|
|
203
|
-
dataVersion: 'primary',
|
|
204
|
-
dataSize: 'medium'
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
// Set click handler
|
|
208
|
-
button.onClick = (event) => {
|
|
209
|
-
console.log('Button clicked!', event);
|
|
210
|
-
};
|
|
211
|
-
|
|
212
|
-
// Add to DOM
|
|
213
|
-
document.body.appendChild(button);
|
|
214
|
-
|
|
215
|
-
// Programmatically focus the button
|
|
216
|
-
button.focus();
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
## Server-Side Rendering
|
|
220
|
-
|
|
221
|
-
```javascript
|
|
222
|
-
import { renderBrickButton } from '@amedia/brick-button/template';
|
|
223
|
-
|
|
224
|
-
const buttonHTML = renderBrickButton({
|
|
225
|
-
dataLabel: 'Server Rendered',
|
|
226
|
-
dataVersion: 'primary',
|
|
227
|
-
dataLinkto: '/page'
|
|
228
|
-
});
|
|
229
|
-
|
|
230
|
-
// Include CSS file
|
|
231
|
-
// <link rel="stylesheet" href="https://assets.acdn.no/pkg/@amedia/brick-button/v9/css/styles.css">
|
|
232
|
-
```
|
|
233
|
-
|
|
234
|
-
## Accessibility
|
|
235
|
-
|
|
236
|
-
- Adheres to **WCAG 2.1 AA** guidelines
|
|
237
|
-
- Full ARIA attributes support for screen readers
|
|
238
|
-
- Keyboard navigation support (Enter/Space for buttons, Enter for links)
|
|
239
|
-
- Focus visible states with clear outline
|
|
240
|
-
- Disabled state prevents interaction and is communicated to assistive technology
|
|
241
|
-
- Icon-only buttons require `data-aria-label` for proper accessibility
|
|
242
|
-
- Proper semantic HTML (`<button>` vs `<a>`) based on behavior
|
|
243
|
-
|
|
244
|
-
## Analytics Integration
|
|
245
|
-
|
|
246
|
-
Brick-button supports ADP (Amedia Data Platform) tracking:
|
|
247
|
-
|
|
248
|
-
```html
|
|
249
|
-
<brick-button-v9
|
|
250
|
-
data-label="Subscribe Now"
|
|
251
|
-
data-version="primary"
|
|
252
|
-
data-adplabel="Subscribe CTA"
|
|
253
|
-
data-adpvalue="homepage-hero">
|
|
254
|
-
</brick-button-v9>
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
## Common Patterns
|
|
258
|
-
|
|
259
|
-
### Call-to-Action Button
|
|
260
|
-
|
|
261
|
-
```html
|
|
262
|
-
<brick-button-v9
|
|
263
|
-
data-label="Start Free Trial"
|
|
264
|
-
data-version="primary"
|
|
265
|
-
data-size="medium"
|
|
266
|
-
data-adplabel="CTA - Free Trial">
|
|
267
|
-
</brick-button-v9>
|
|
268
|
-
```
|
|
269
|
-
|
|
270
|
-
### Modal Trigger with ARIA
|
|
271
|
-
|
|
272
|
-
```html
|
|
273
|
-
<brick-button-v9
|
|
274
|
-
data-label="Open Settings"
|
|
275
|
-
data-version="secondary"
|
|
276
|
-
data-aria-controls="settings-modal"
|
|
277
|
-
data-aria-expanded="false"
|
|
278
|
-
data-icon-id="settings">
|
|
279
|
-
</brick-button-v9>
|
|
280
|
-
```
|
|
281
|
-
|
|
282
|
-
### Toggle Button
|
|
283
|
-
|
|
284
|
-
```html
|
|
285
|
-
<brick-button-v9
|
|
286
|
-
data-label="Follow"
|
|
287
|
-
data-version="outlined"
|
|
288
|
-
data-aria-pressed="false">
|
|
289
|
-
</brick-button-v9>
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
### Navigation with Icon
|
|
293
|
-
|
|
294
|
-
```html
|
|
295
|
-
<brick-button-v9
|
|
296
|
-
data-label="Next"
|
|
297
|
-
data-version="primary"
|
|
298
|
-
data-linkto="/next-page"
|
|
299
|
-
data-icon-id="arrow-right"
|
|
300
|
-
data-iconplacement="right">
|
|
301
|
-
</brick-button-v9>
|
|
302
|
-
```
|
|
303
|
-
|
|
304
|
-
## Styling and CSS Properties
|
|
305
|
-
|
|
306
|
-
Customize button appearance using CSS custom properties:
|
|
307
|
-
|
|
308
|
-
```css
|
|
309
|
-
brick-button-v9 {
|
|
310
|
-
/* Width control */
|
|
311
|
-
--b-button-width: 100%;
|
|
312
|
-
|
|
313
|
-
/* Height control */
|
|
314
|
-
--b-button-height: 3rem;
|
|
315
|
-
|
|
316
|
-
/* Border width */
|
|
317
|
-
--b-button-border: 2px;
|
|
318
|
-
|
|
319
|
-
/* Border radius */
|
|
320
|
-
--b-button-radii: 8px;
|
|
321
|
-
|
|
322
|
-
/* Content alignment */
|
|
323
|
-
--b-button-justify: flex-start;
|
|
324
|
-
}
|
|
325
|
-
```
|
|
326
|
-
|
|
327
|
-
### Color Overrides
|
|
328
|
-
|
|
329
|
-
```css
|
|
330
|
-
brick-button-v9 {
|
|
331
|
-
/* Primary button colors */
|
|
332
|
-
--brick-colors-buttonPrimaryBg: var(--brick-colors-utilityWarningBg);
|
|
333
|
-
--brick-colors-buttonPrimaryHoverBg: var(--brick-colors-utilityWarningBg);
|
|
334
|
-
--brick-colors-buttonPrimaryActiveBg: var(--brick-colors-utilityWarningBg);
|
|
335
|
-
--brick-colors-buttonPrimaryFg: var(--brick-colors-utilityWarningFg);
|
|
336
|
-
}
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
**Note:** When overriding colors, ensure your customizations adhere to WCAG 2.1 AA contrast requirements.
|
|
340
|
-
|
|
341
|
-
## Technical Details
|
|
342
|
-
|
|
343
|
-
- **Custom Element**: `brick-button-v9`
|
|
344
|
-
- **Base Class**: BrickElement
|
|
345
|
-
- **Dependencies**:
|
|
346
|
-
- @amedia/brick-tokens (design tokens)
|
|
347
|
-
- @amedia/brick-icon (icon support)
|
|
348
|
-
- @amedia/brick-template (base class)
|
|
349
|
-
- **Renders as**: `<button>` (default) or `<a>` (when data-linkto is set) or `<span>`/`<div>` (when data-as is set)
|
|
350
|
-
- **SSR Compatible**: Yes, with hydration support
|
|
351
|
-
- **Framework**: Framework-agnostic web component
|
|
352
|
-
|
|
353
|
-
## Important Notes
|
|
354
|
-
|
|
355
|
-
- When `data-linkto` is provided, the component renders as an `<a>` tag; otherwise, it renders as a `<button>` tag
|
|
356
|
-
- When `data-as` is set to `span` or `div`, renders as non-interactive element (useful for wrapping with framework router components)
|
|
357
|
-
- Icon-only buttons automatically get rounded background styling
|
|
358
|
-
- The component observes attribute changes and updates the DOM reactively for `data-label`, `data-icon-id`, `data-icontext`, `data-linkto`, and all ARIA attributes
|
|
359
|
-
- Do not nest interactive elements inside brick-button when using framework routers - use `data-as` instead
|
|
360
|
-
- Version 9.0.0 removed CommonJS support and changed `data-iconid` to `data-icon-id`
|
|
361
|
-
|
|
362
|
-
## Version
|
|
363
|
-
|
|
364
|
-
Current version: 9.3.1
|