We have ported our internal Ember Semantic-UI components for an official Semantic-UI integration. The code was original built for CrowdOx and later SpruceMail. This is officially in Alpha. We would appreciate any feedback that you might have.
We feel that the Semantic-UI-Ember project should be an extension of Semantic-UI and not a complete rewrite. With that in mind, we will only be creating components to extend Semantic-UI modules, all other uses of Semantic-UI in your project should follow the official documentation.
As mentioned our goal is to let Semantic do most of the work and we will simply maintain small bits of code to make it native for Ember. We will release when there are new components or incompatibilities but otherwise the same version should continue to work.
Include the library as an NPM dependency, from within an ember-cli app.
ember install semantic-ui-ember
If using ember-cli 0.1.5 – 0.2.3
ember install:addon semantic-ui-ember
If using ember-cli < 0.1.5
npm install --save-dev Semantic-Org/Semantic-UI-Ember
Run the library's blueprint to pull in its Bower dependencies. This only needs to be done once.
ember generate semantic-ui-ember
- Documentation: Official Documentation
- Class:
ui accordion
- Component:
ui-accordion
Replace <div class="ui accordion">
with {{#ui-accordion}}
and fill the inside content with standard Semantic-UI.
Variations can be used with {{#ui-accordion class="styled"}}
.
- Documentation: Official Documentation
- Class:
ui checkbox
- Component:
ui-checkbox
Replace <div class="ui checkbox">
with {{ui-checkbox}}
and bind to a property on your model/controller/component.
export default Ember.Controller.extend({
havingFun: false
});
- Class:
ui radio
- Component:
ui-radio
Replace <div class="ui radio">
with {{ui-radio}}
and bind to a property on your model/controller/component.
export default Ember.Controller.extend({
fruit: null
});
- Documentation: Official Documentation
There isn't a corresponding Ember component for this since it isn't rendered to the screen but instead invoked.
- Documentation: Official Documentation
- Ember.Select: [Follows Ember.Select Style](http://emberjs.com/api/classes/Ember.Select.html#sts=Ember.Select Class packages/ember-handlebars/lib/controls/select.js:93)
- Class:
ui dropdown
- Component:
ui-dropdown
- Parameters
- content: List of data that you want displayed. Required
- value: Bound value that is set to
optionValuePath
- prompt: Text to display before an option has been chosen
- icon: Icon you want to use. Default is
dropdown
- optionLabelPath: Path to the label that is displayed for each item. Default is
content
- optionValuePath: Path to the value that is used when an item is selected. Default is
content
Replace <div class="ui dropdown">
with {{ui-dropdown}}
and bind to a list and set a bound property.
export default Ember.Controller.extend({
itemActions: [ "Edit", "Remove", "Hide"],
selectedAction: null
});
- Documentation: Official Documentation
- Class:
ui modal
- View:
ui-modal
In order to use the modal you must first prepare your Ember application for modals. This follows the same instructions found on ember.js.
You must add the modal
outlet to the main application layout
- templates/application.hbs OR
- pods/application/template.hbs
This provides the openModal
and closeModal
actions that allows modals to be opened from any controller.
- routes/application.js OR
- pods/application/route.js
import SemanticRouteMixin from 'semantic-ui-ember/mixins/application-route';
var ApplicationRoute = Ember.Route.extend(SemanticRouteMixin, {});
Now to use the modal the bare minimum is to create a template and trigger openModal
.
Then you can fire openModal
from any controller
export default Ember.Controller.extend({
actions: {
confirm: function() {
this.send('openModal', 'projects/confirm');
}
}
});
If you want to send a model in just use the third parameter
export default Ember.Controller.extend({
actions: {
confirm: function() {
this.send('openModal', 'projects/confirm', this.get('model'));
}
}
});
If a controller is found with the same name as the template it will be used. You can also use your own view if necessary. You just need to make sure to inherit from the base class.
import Ember from 'ember';
import SemanticModalMixin from 'semantic-ui-ember/mixins/modal';
export default Ember.View.extend(SemanticModalMixin, {
templateName: 'shared/modal'
})
- Documentation: Official Documentation
- Class:
ui popup
- Component:
ui-popup
Replace <div class="ui popup">
with {{ui-popup}}
and fill the inside content with standard Semantic-UI.
You can also create an icon version by specifying the tagName
- Documentation: Official Documentation
- Class:
ui rating
NOT IMPLEMENTED
- Documentation: Official Documentation
- Class:
ui shape
NOT IMPLEMENTED
- Documentation: Official Documentation
- Class:
ui sidebar
NOT IMPLEMENTED
- Documentation: Official Documentation
- Class:
ui sidebar
There isn't a cooresponding Ember component for this since it isn't rendered to the screen but instead invoked.