Skip to content

Commit 79aaadb

Browse files
committed
Add inline select component
1 parent 113b634 commit 79aaadb

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/select/select.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { Component, Input } from "@angular/core";
44
selector: "ibm-select",
55
template: `
66
<div class="bx--form-item">
7-
<div class="bx--select">
7+
<div class="bx--select"
8+
[ngClass]="{ 'bx--select--inline': inlineSelect }">
89
<label [attr.for]="id" class="bx--label">{{label}}</label>
910
<select [attr.id]="id" class="bx--select-input">
1011
<ng-content></ng-content>
@@ -18,6 +19,7 @@ import { Component, Input } from "@angular/core";
1819
})
1920
export class Select {
2021
static selectCount = 0;
22+
@Input() inlineSelect = false;
2123
@Input() label = "Select label";
2224
@Input() id = `select-${Select.selectCount++}`;
2325
}

src/select/select.stories.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,20 @@ storiesOf("Select", module).addDecorator(
2525
</optgroup>
2626
</ibm-select>
2727
`
28+
}))
29+
.add("Inline", () => ({
30+
template: `
31+
<ibm-select inlineSelect="true">
32+
<option value="" disabled selected hidden>Choose an option</option>
33+
<option value="solong">A much longer option that is worth having around to check how text flows</option>
34+
<optgroup label="Category 1">
35+
<option value="option1">Option 1</option>
36+
<option value="option2">Option 2</option>
37+
</optgroup>
38+
<optgroup label="Category 2">
39+
<option value="option1">Option 1</option>
40+
<option value="option2">Option 2</option>
41+
</optgroup>
42+
</ibm-select>
43+
`
2844
}));

0 commit comments

Comments
 (0)