Skip to content

Commit 0f78523

Browse files
committed
add Semantic UI module guidelines
1 parent f6736d6 commit 0f78523

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

docs/app/Component Guidelines.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Every component in Stardust must conform to these guidelines.
44
They ensure consistency and optimal development experience for Stardust users.
55

6+
1. Semantic UI
7+
- [Modules](#Modules)
68
1. [Classes](#Classes)
79
- [Extend React.Component](#Extend React.Component)
810
- [Identical class and component names](#Identical class and component names)
@@ -11,6 +13,44 @@ They ensure consistency and optimal development experience for Stardust users.
1113
1. [Props](#Props)
1214
- [className](#className)
1315

16+
## Semantic UI
17+
18+
### Modules
19+
20+
Semantic UI [Modules](http://semantic-ui.com/introduction/glossary.html) are components that include a jQuery plugin.
21+
These are things that have state, like a [Dropdown](http://semantic-ui.com/modules/dropdown.html).
22+
23+
**Element**
24+
Stardust components exposes the jQuery element on the component as `element`:
25+
26+
```jsx
27+
let checkbox = <Checkbox />;
28+
checkbox.element; // the jQuery element
29+
```
30+
31+
**Plugin**
32+
The jQuery plugin can be called using `element`:
33+
34+
```jsx
35+
let checkbox = <Checkbox />;
36+
checkbox.element.checkbox(); // the Semantic UI Checkbox plugin
37+
```
38+
You can also trigger behaviors with the plugin:
39+
40+
```jsx
41+
let checkbox = <Checkbox />;
42+
checkbox.element.checkbox('toggle'); // toggles the checkbox
43+
```
44+
45+
**Settings**
46+
Module jQuery plugins can be configured via the `settings` prop:
47+
48+
```jsx
49+
let settings = {allowAdditions: true};
50+
let dropdown = <Dropdown settings={settings}/>;
51+
```
52+
>Settings are applied on componentDidMount.
53+
1454
## Classes
1555

1656
### Extend React.Component

0 commit comments

Comments
 (0)