Skip to content

Commit

Permalink
refactor(chip): added selected state (#1003)
Browse files Browse the repository at this point in the history
refactor: added selected state
  • Loading branch information
mfranzke authored Feb 15, 2023
1 parent fc75249 commit 6984a40
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ export class DbChip {
*/
@Prop({ reflect: true }) name = 'chips';

/**
* Selected state
*/
@Prop({ reflect: true }) selected? = false;

/**
* Predefined variants to change background color and font color.
*/
Expand Down Expand Up @@ -66,6 +71,7 @@ export class DbChip {
data-type={this.datatype}
disabled={this.disabled}
name={this.name}
checked={this.selected}
/>
<label
htmlFor={this.input_id}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
| `iconafter` | `iconafter` | Attribute to add icon after chip. | `string` | `undefined` |
| `input_id` | `input_id` | The input_id of a label form-related element in the same document as the label element. The first element in the document with an id matching the value of the for attribute is the labeled control for this label element, if it is a label element. | `string` | `'chip-' + uuid()` |
| `name` | `name` | Name to group multiple chips. | `string` | `'chips'` |
| `selected` | `selected` | Selected state | `boolean` | `false` |
| `variant` | `variant` | Predefined variants to change background color and font color. | `"error" \| "informative" \| "poi-db-services-einrichtung" \| "poi-dienstleistungen" \| "poi-einkaufen" \| "poi-essen-trinken" \| "poi-freizeit" \| "poi-gesundheit" \| "poi-kunst-kultur" \| "poi-wegeleitung" \| "poi-wissenswertes" \| "poi-zivile-rel-einrichtungen" \| "success" \| "track" \| "warning"` | `undefined` |


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import Readme from './../readme.md';
<db-chip datatype="filter" variant="poi-essen-trinken">
poi-essen-trinken
</db-chip>
<db-chip datatype="filter" variant="poi-einkaufen">
<db-chip datatype="filter" variant="poi-einkaufen" selected>
poi-einkaufen
</db-chip>
<db-chip datatype="filter" variant="track">
Expand All @@ -32,7 +32,7 @@ import Readme from './../readme.md';
<db-chip>default</db-chip>
<db-chip variant="informative">informative</db-chip>
<db-chip variant="success">success</db-chip>
<db-chip variant="poi-essen-trinken">poi-essen-trinken</db-chip>
<db-chip variant="poi-essen-trinken" selected>poi-essen-trinken</db-chip>
<db-chip variant="poi-einkaufen">poi-einkaufen</db-chip>
<db-chip variant="track">track</db-chip>
</Canvas>
Expand Down

0 comments on commit 6984a40

Please sign in to comment.