Skip to content

Commit aa2991c

Browse files
committed
issue #163: light select style
1 parent dad486a commit aa2991c

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

src/select/select.component.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from "@angular/forms";
2929
template: `
3030
<div class="bx--form-item">
3131
<div
32-
[ngClass]="{'bx--select--inline': display === 'inline'}"
32+
[ngClass]="{
33+
'bx--select--inline': display === 'inline',
34+
'bx--select--light': theme === 'light'
35+
}"
3336
class="bx--select">
3437
<label [attr.for]="id" class="bx--label">{{label}}</label>
3538
<select
@@ -76,6 +79,10 @@ export class Select implements ControlValueAccessor {
7679
* Set to true to disable component.
7780
*/
7881
@Input() disabled = false;
82+
/**
83+
* `light` or `dark` select theme
84+
*/
85+
@Input() theme: "light" | "dark" = "dark";
7986
/**
8087
* emits the selected options `value`
8188
*/

src/select/select.stories.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { storiesOf, moduleMetadata } from "@storybook/angular";
22
import { action } from "@storybook/addon-actions";
3-
import { withKnobs, boolean } from "@storybook/addon-knobs/angular";
3+
import { withKnobs } from "@storybook/addon-knobs/angular";
44

55
import { SelectModule } from "../";
66

@@ -42,6 +42,22 @@ storiesOf("Select", module).addDecorator(
4242
</ibm-select>
4343
`
4444
}))
45+
.add("Light", () => ({
46+
template: `
47+
<ibm-select [theme]="'light'">
48+
<option value="" disabled selected hidden>Choose an option</option>
49+
<option value="solong">A much longer option that is worth having around to check how text flows</option>
50+
<optgroup label="Category 1">
51+
<option value="option1">Option 1</option>
52+
<option value="option2">Option 2</option>
53+
</optgroup>
54+
<optgroup label="Category 2">
55+
<option value="option1">Option 1</option>
56+
<option value="option2">Option 2</option>
57+
</optgroup>
58+
</ibm-select>
59+
`
60+
}))
4561
.add("With ngModel", () => ({
4662
template: `
4763
<ibm-select [(ngModel)]="model">

0 commit comments

Comments
 (0)