|
| 1 | +# `<pg-button-toggle>` |
| 2 | + |
| 3 | +The `pg-button-toggle` component is essentially just a button with swappable slotted content. Commonly used with icons, but using `span` elements will allow assigning text content. |
| 4 | + |
| 5 | +```typescript |
| 6 | +import '@pictogrammers/components/pg/buttonToggle'; |
| 7 | +import PgButtonToggle from '@pictogrammers/components/pg/buttonToggle'; |
| 8 | +``` |
| 9 | + |
| 10 | +```html |
| 11 | +<pg-button-toggle> |
| 12 | + <pg-icon slot="active" path="M...Z"></pg-icon> |
| 13 | + <pg-icon slot="inactive" path="M...Z"></pg-icon> |
| 14 | +</pg-button-toggle> |
| 15 | +``` |
| 16 | + |
| 17 | +| Slots | Tested | Description | |
| 18 | +| ----------- | -------- | ----------- | |
| 19 | +| default | ✅ | Button contents. | |
| 20 | + |
| 21 | +| Attribute | Tested | Description | |
| 22 | +| ---------- | -------- | ----------- | |
| 23 | +| block | | block sizing | |
| 24 | +| active | | Depressed visual state. | |
| 25 | +| start | | Internal Only | |
| 26 | +| end | | Internal Only | |
| 27 | +| center | | Internal Only | |
| 28 | + |
| 29 | +| Events | Tested | Description | |
| 30 | +| ---------- | -------- | ----------- | |
| 31 | +| click | ✅ | Standard click. | |
| 32 | + |
| 33 | +| CSS Variables | Default | Description | |
| 34 | +| ------------------- | --------- | ----------- | |
| 35 | +| `--pg-button-color` | `#453C4F` | Text color | |
| 36 | +| `--pg-button-background-color` | `#fff` | Background color | |
| 37 | +| `--pg-button-border-color` | `#453C4F` | Border color | |
| 38 | +| `--pg-button-hover-color` | `#fff` | `:hover` Text color | |
| 39 | +| `--pg-button-hover-background-color` | `#453C4F` | `:hover` Background color | |
| 40 | +| `--pg-button-hover-border-color` | `#453C4F` | `:hover` Border color | |
| 41 | +| `--pg-button-active-color` | `#fff` | `active` Text color | |
| 42 | +| `--pg-button-active-background-color` | `#453C4F` | `active` Background color | |
| 43 | +| `--pg-button-active-border-color` | `#453C4F` | `active` Border color | |
| 44 | + |
| 45 | +### Slots |
| 46 | + |
| 47 | +Special styling is applied for `pg-icon`. |
| 48 | + |
| 49 | +```html |
| 50 | +<pg-button-toggle> |
| 51 | + <pg-icon slot="active" path="M...Z"></pg-icon> |
| 52 | + <pg-icon slot="inactive" path="M...Z"></pg-icon> |
| 53 | +</pg-button-toggle> |
| 54 | +``` |
0 commit comments