Version 2.0.19 - last update November 16, 2020
Hover to get more details. Click to copy hexadecimal code.
By default, the page container has a width limited to 1000px.
Add the full-width class to #screen-content to allow the content to fill all available space.
Add the wider class to #screen-content to make the mage wider (1200px instead of 1000px).
<div id="screen-content" class="full-width">
...
</div>
sfe-page
Container for standard pages.
sfe-page page-form
You can add a section form above the page content with page-form. This is recommended for forms.
sfe-page page-form
Replace .page-content by .page-content-two-columns to have a vertical form.
sfe-page with-tabs
Dynamic tabs allows to switch tabs without reloading the page. This is best for the user.
page-tabs
Sometimes, each tab must be a separate page for technical reason. In this case, the tabs must be set as links.
Add the disabled attribute to disable a tab. Disabled tab can not be clicked and display as muted.
Note: it's a good practice to let the user know why the tab is disabled and what action they can take in order to use the button. This can typically be done with a tooltip applied on the tab.
sfe-widget
Most content should be contained in widgets. There can either be one large widget, or several smaller ones.
sfe-widget with-tabs
Follow the structure below for widgets with tabs. The tabs will autmatically show the tab-content with the same index (for example, third tab will be linked to third tab-content).
Make sure the default tab and its content have the active class.
sfe-record-card
A component halfway between a widget and a table. Useful when there are only a few records to display.
This component allows a higher information density than typical tables.
The component has a header, a preview and a content part. By default, the header and preview are displayed. A click on the header will toggle the content part.
The line on the left is supposed to reflect the status of the record. The following classes can be applied: status-success status-fail status-info status-warning status-new
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur.
Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
sfe-columns
Simple layout component to create columns.
To fix the width of columns, use the classes two-columns, three-columns, four-columns.
By default, there is no line. Add the with-line class to separate the columns by a thin line.
With two columns, each column is 50% wide by default. Add the ratio-2-1 or ratio-3-1 class to the sfe-columns element to make the first column 2/3 or 3/4 of the width.
The gap between columns is 32px by default. Add the tighter class to make the columns tighter (16px gap). Add the no-spacing class to completely remove the gap between columns.
sfe-spread-content
Simple layout component to divide and spread the content horizontally.
By default, the elements are aligned to the top. Add the vertically-centered class if you want elements to be centered vertically.
sfe-center
sfe-right
Simple layout component to align the content center or right.
sfe-margin-vertical
To space elements vertically. Adds a small margin above and below the content.
Use the sfe-margin-top and sfe-margin-bottom to control the margin at the top and bottom.
Likewise, the horizontal margin can be controled by sfe-margin-horizontal, sfe-margin-left and sfe-margin-right.
sfe-break-words
Prevents long long words from overflowing their container.
Warning: this might break in the middle of a word!
sfe-autocut
Apply this class to a container to show only one line of the text, and display an ellipsis (...) at the end if it's longer. You can use this anywhere, including in tables.
This component applies no design by itself, it only cuts the text.
Add the sfe-tooltip class if you'd like to display the full content in a tooltip on mouse hover. The tooltip will only show if the content is cut.
Note: the text must be directly inside the element with sfe-autocut. Don't wrap it into any additional tag inside as it will cause issue (missing ellipsis for example).
sfe-content-switch
This will toggle the display of elements based on the value of a field. It can work with any field, but is typically used with dropdowns or checkboxes.
Put the mapping of elements to display in the data-content-switch attribute using the following syntax:
value:selector. When the field's value equals value, the elements corresponding to selector will be displayed.on and off.value:#element-id to affect a specific element, or value:.element-class to affect all elements with a class.value:#element-a,#element-b.value-1:#element-a;value-2:#element-b. You can however not have the same values multiple times.
sfe-button
Buttons should be used to call action (submit something, save something, create something, etc.). They can occasionall also be used to link to another page.
Add the sfe-button class to a button, link or form control.
If the button links to a page, use a <a> anchor tag. If the button calls a Javascript function, use a <button> tag. If the button submits a form, use a <input type="submit"> form control.
Note: If you include a button in a form, by default it will submit the form (standard HTML behaviour). Addtype="button" to prevent this default behaviour.
Use the primary class to mark the button leading to the primary action. There should ideally not be more than one primary button visible on any given screen.
The button size can be controled with the small and big classes.
Note: buttons placed in a form with large controls will automatically display as big.
Primary and secondary buttons have a minimum width by default. Add the compact class to get rid of the minimum width.
Add the disabled attribute to disable the button. Disabled buttons can not be clicked and display as muted.
Note: it's a good practice to let the user know why the button is disabled and what action they can take in order to use the button. This can typically be done with a tooltip applied on the button.
Add the restriced class to disable the button. Disabled buttons display as muted with an icon.
Note: it's a good practice to let the user know why the button is restricted. This can typically be done with a tooltip applied on the button.
Note: the restricted class doesn't prevent the user from clicking on it, so make sure that no function is attached to it.
Add the loading class to a button to make it look like it's loading. This prevents the user to click the button again.
Make sure to catch the clicks on the button and discard them.
In the exemple below, the loading class is added on click, and removed after 2 seconds.
sfe-button with-icon
Add the with-icon class and an icon name to add an icon to a button.
This works on any button and the icon color will adapt to the button color.
Note: Unfortunately icons can not be added on <input> elements.
Add the no-text class to create buttons with no text. Make sure to use icons that are self-explanatory.
Note: text should still be added in the button for accessibility purpose (screen readers, blind people, etc.).
Creating links works the same way as buttons.
sfe-icon
Small component to display an icon.
The icon takes the color and size of the text around.
| icon-paw | icon-edit | icon-cross | icon-save |
| icon-left | icon-right | icon-doc | icon-download |
| icon-info | icon-share | icon-search | icon-gift |
| icon-external | icon-calendar | icon-plus | icon-grip |
| icon-check | icon-ellipsis | icon-refresh | icon-warning |
| icon-tool | icon-delete | icon-lock | icon-refund |
| icon-replace |
Need to add an icon? Instructions about adding new icons are placed in the CSS file (components.css around line 250 at time of writing).
sfe-mall-icon
Simple icons for each mall. Use the class sfe-mall-icon followed by the class name of the mall.
sfe-tag
Add a span inside the tag to automatically cut long captions. This is necessary on some layouts where space is limited. It'll cut the tag after 200px, or 20 Japanese characters.
Add a span with a badge class at the end of the tag to display the count of elements tagged.
The following classes will add a colored bullet to the tag: new warning fail success default.
Add classes tag-style-a to tag-style-f for the user tags predefined colors.
Add the blocker class to show a tag is blocking the current record.
sfe-badge
A simple component to display a highlighted piece of information
sfe-status
Simple component to display a status with a colored bullet. The classes for orders correspond to the BOSS status values.
| Bullet | Class | Meaning |
|---|---|---|
| new | New, will change to another status automatically | |
| ok | All good mate | |
| warning | Warning, minor issue, unusual situation | |
| not-ok | Failure, major issue, blocking | |
| active | Currently processing something | |
| done | Finished, final status and won't change | |
| inactive | Inactive, not applicable | |
| caution | Not as serious as warning | |
| deleted | The item has been deleted |
sfe-tooltips
Use tooltips to provide additional contextual details that will be displayed on rollover. You can add tooltips on most elements (tags, buttons, links, etc.).
The library will look for the content of the tooltip the following ways:
sfe-tooltip-content placed immediately after the element. This is useful to place HTML into the tooltip.If needed, you can control the width of the tooltip with the attribute data-tooltip-width.
You can change the visual style of the tooltip by adding classes dark-tooltip-style or alt-tooltip-style.
If you need to open a tooltip below its target, add the tooltip-below class.
You can also make the tooltip stay visible when the user move the mouse to it, if necessary. Avoid using this feature as it can be quite irritating.
The tooltip can be added on any HTML element. In this example, it's applied on a tag, a button and an ico.
Add the tooltip-below class to open the tooltip below instead of above its trigger element.
The style can be changed by adding the dark-tooltip-style or alt-tooltip-style classes.
If the content contains HTML, it can't be put in the title attribute. In this case, it can be put inside a div with the sfe-tooltip-content class directly after the tag element.
If the content needs to be interacted with, for example containing a link, add the interactive class. This will make the tooltip stay open when the user leaves the tooltip trigger, in order to let them interact with its content.
The width of the tooltip can be controled by the data-tooltip-width attribute. The width must be specified in pixel.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
If the content of the tooltip isn't specified, the content of the trigger will be used instead and show if the content is wider than its container. This typically happens when using sfe-autocut. This is useful on cases the content is cut, as the full content will be displayed on hover.
sfe-notification
Used to show a notification / message to the user.
There are 4 classes to give an appropriate look to the message: success fail info warning.
Buttons can be added if necessary in an additional div with the class actions.
Note: Make sure the message is short, clear and helpful. Avoid technical jargon. Help the user understand what went wrong and how to fix it.
Note: Place the notifications close to the control that triggered them (ideally right under the submit button).
sfeNotifications.add(class, message)
You can call a JS function to display ajax notifications.
Those notifications will be displayed at the bottom right corner of the screen.
A class for the notification must be passed as the first argument (success fail info warning). The second argument is the text for the message. The text can contain HTML. Error messages will stay visible, while other classes will disappear after 5 seconds.
sfe-text-danger
sfe-text-warning
sfe-text-success
sfe-text-info
Use those classes to change the color / weight of texts.
sfe-wizard-steps
Used to show progress in wizards. The state of each step is controlled by classes (completed, current and pending). Completed steps should be a link.
Should be used on gray background, outside of a page container.
sfe-progress
Use this to guide the user through a procedure.
Should be used on white background, inside of a page container.
sfe-empty-state
Large placeholder to use as empty states. Keep the text helpful for the user and lead them to the next step.
sfe-placeholder
Small placeholder to use in empty states and empty lists. Is smaller than sfe-empty-state and should typically be used for subsections.
Keep the text simple and straightforward, it's there to help the user.
sfe-pagination
If there are less than 10 pages, display all the pages. If there are more, display the first, last, and current page with two adjacent pages on each side.
sfe-action-bar
The action bar stays sticky at the bottom its container while scrolling.
It's useful for tables or particularly large forms.
If needed, the content of the action bar can be organized with layout components such as sfe-spread-content. It's recommended to keep it as simple as possible.
sfe-loading
Use this component as a placeholder when some content is loading. The animation is display at the center horizontally and has margins vertically.
The size can be changed with the big or small classes.
sfe-announcement-bar
Use this for major announcements.
It can be used anywhere, but had been designed to be at the top of the bage, right below <body>.
By default, the bar can't be dismissed. Add the dismissable class to make the bar dismissable.
sfe-slider
An image slider. Also known as a carousel.
The slides can be div elements or links.
Note: the slider supports slide gesture. If you wish to use slide gestures, make sure the jQuery touchSwipe library is loaded.
sfe-dropdown-panel
A dropdown panels that opens above the content to show information or controls.
sfe-show-more
A button that shows or hide a block. The block can be anywhere in the page, but should ideally be placed below the trigger button.
Set the target in the data-target attribute. This can either be an ID or a jQuery selector (for example .something, input[type='text']).
An alternative text can be put in the data-alt-text attribute, that will be displayed when the target is open. If this attribute is missing, the text will not change.
Note: Sometimes the animation can cause issues (for example in modals). The animation can be disabled by adding the no-animation class.
sfe-dropdown
A custom dropdown component that can be used for advanced forms.
Note: Add the disabled class to make the dropdown disabled. The dropdown will appear disabled and the user will not be able to select any option.
This is the most basic sample of sfe-dropdown.
The component can me modified with the following classes:
searchable: allow the user to type to filter options.multi-select: allow the user to select more than one option.always-open: the dropdown is always open, rather than dropping down on focus.options-inline: the options are displayed inline, rather than one on each row.The maximum number of items that can be selected the user can be set with the attribute data-max-count. If the user tries to select more than the mount specified, a red message will appear under the field. By default, if the attribute is not present, there are not limits.
The value of a dropdown can be recovered in javascript with the getSelection() method. It'll return an array with all the values selected.
The sample below will get the values of the tag selector used in the previous example.
If some options have to be selected at the initial pageload, add the selected class on the option as below.
Since the dropdown is a complex element, it can't simply be cloned after being initialized.
If you wish to have a clonable dropdown, you must first make a template by adding the template-element class to it. This element will not be initialized on the page load, and will be unusable. It's a good idea to keep it hidden from the user.
This element can then be cloned using the .cloneInto(target) method. Pass the target dom node as parameter, and the cloned element will be appended into this node.
sfe-field-text
Add the sfe-field-text class to a text or email field to give it the standard appearance.
sfe-field-dropdown
Add the sfe-field-dropdown class to a select field to give it the right appearance.
Note: If no value is selected, the default placeholder value must have the disabled and selected attributes, and should be affixed with dashes to differentiate it from actual values.
sfe-field-textarea
Standard textarea. The textarea size adapts automatically to its content.
To limit the height of a textarea, add the limit-height class. This will limit the height to two and a half lines. The height will automatically adapt to show the whole content when the user focuses on the field.
To give a minimum height to the textarea, add the min-height class. This will make the box at least 5 rows high even if the content is shorter.
To prevent linebreaks in a textarea, add the no-linebreak class. The user will not be able to input any linebreaks.
To prevent linebreaks in a textarea, add the no-linebreak class. The user will not be able to input any linebreaks.
sfe-field-checkbox
To get the proper styling, checkboxes need additional markup (since standard checkboxes can not be styled in CSS). This markup is added automatically in javascript after the page load.
In some cases, the full dom might have to be present. Both options are shown in the example below.
Add the larger class to have a larger checkbox.
Note: The additional markup takes a fraction of a second to be added. It's recommended to use the full markup for prominent checkboxes, otherwise the unstyled box will briefly be visible.
Note: If included in a form with the .sfe-form.larger class, the checkboxes are automatically made larger, unless they're within a subfield.
Note: By default, there is a 20px space on the right of the checkbox, before the next element. This space can be removed by adding the no-spacing class.
sfe-field-switch
A stylized switch control based on a modified checkbox.
Note: The additional markup takes a fraction of a second to be added. It's recommended to use the full markup for prominent switches, otherwise the unstyled checkbox will briefly be visible.
Note: The text in the component can not be changed.
sfe-field-radio
Radio buttons are managed similarly to checkboxes. The UI library will automatically add the necessary markup.
sfe-field-range
Two fields for a range. The fields are automatically separated by a en dash to signify the range, following the APA style notation.
The fields will fill all the available width of the conainer.
sfe-field-tokenize
A field containing tokens. Users can type and add new tokens by typing comma or enter.
The tokens are stored as text in the original field, separated by commas.
The amount of tokens can can be limited by the data-max-count attribute. This also limits the amount of tokens that can be added programmatically.
In the example below, the user can only add 3 tokens.
The not-editable class makes the field not editable by the user, although they can still be deleted. Tokens are typically added by javascript when using non editable token fields.
Note: to completely disable a token field, simply use the disable attribute. This will prevent the user from interactive in any way with it.
Tokens can be added by javascript, using the addToken method, as in the example below.
sfe-field-date
Field for dates. An icon is added to the field and a datepicker drops down when the field is focused.
Note: As this also apply the .sfe-field-text class to have the correct styling.
Note: For legacy reasons, the date field is automatically validated by the UI library. If you'd rather perform the validation manually, add the no-validation class to the date field.
Dependencies: the date picker requires the datepicker.js library to be loaded. If the library is missing, an error message will be displayed under the field.
sfe-field-daterange
Use this component for date range. A double date picker drops down when one of the fields has focus
Dependencies: the date range picker requires the datepicker.js library to be loaded. If the library is missing, an error message will be displayed under the fields.
Note: For legacy reasons, the daterange field is automatically validated by the UI library. If you'd rather perform the validation manually, add the no-validation class to the sfe-field-daterange element.
monetary-field
There are special classes for monetary, percentage and item count fields.
Enclose the field in a div with the corresponding class to add the character.
It's recommended to set the field to an appropriate size.
sfe-field-with-button
Put a button attached to a field.
If needed, add the wider class to make the button wider to accomodate longer words.
sfe-unsaved-changes
Add the sfe-unsaved-changes class to an element to track the changes done to the fields inside. If any change was made, the user will receive a warning when they're trying to leave the page.
This also tracks the changes made in tables (drag and drop, add or remove rows).
If an action bar is present in the container, it will display a small notice next to the primary button.
Note: it is recommended to add the sfe-unsaved-changes on the sfe-page element.
Note: to exclude a field from the change detection, add the ignore-changes on the field. With this class, changes to this field will not trigger the component.
Note: add the discard-unsaved-changes on a button to make it discard the unsaved changes on click.
Change the value of a field and try refreshing the page.
Changes can be triggered or canceled by javascript by calling the methods hasChanged() and discardChanges().
See the example below.
sfe-form sfe-field
Use the following structure for standard forms.
sfe-form.larger
Add the larger class to a form to make it larger.
It will make the fields larger. This is appropriate for forms that have few controls.
sfe-form.compact
Add the compact class to a form to make it compact.
It will make the labels smaller, and reduce the space between the fields. This is appropriate for forms that have to fit into small spaces, or forms that have many controls.
sfe-field.half sfe-field.third
Add the half, third or quarter class to a field to make it fill only a fraction of the space available.
This allows to create columns to organize your fields and build more complex forms.
Note: sfe-columns can not be used inside sfe-form.
form-title
A title can be added to forms with the form-title class. This is useful when trying to group many fields into several subsections. Those titles work best on compact forms, since the field labels are smaller.
form-meta
An additional element can be added at the top right of form, using a form-meta element. This should only be used together with a form-title.
This is useful to provide an additional link or control to the form.
sub-field sfe-field-note
Additional elements can be added for fields.
Anything in a sub-field element will be displayed at the top right. This element should always be placed before the sfe-field-label.
Small notes can be added under the field using the sfe-field-note class.
sfe-check-all
Add a control with .sfe-check-all class to invert the status of all the checkboxes that are in the same .field container.
A good place to add the control is in the .sub-field, next to the label.
sfe-text-value
Sometimes a value has to be displayed as text rather than as a field within a form.
Replace the field by an element with the sfe-text-value class to enclose the text value. This will insure that the form stays aligned if you have several rows and columns.
Note: Disabled fields are also a good choice for uneditable values.
sfe-field-error
Use this class to highlight errors in a form. The class must be applied to an element wrapping the field.
An explanation about the error should be provided in a <div class="sfe-note error"> below the field.
sfe-values-list
This is an alternative to sfe-form. It's useful to display vertical lists with small values.
It can be used to list both static values or form controls.
If the list must fit in a narrow column, add the vertical class to make the list vertical.
sfe-table
The basic HTML tables can be used when advanced functionalities are not required.
Make sure <thead> and <tbody> are present in the HTML.
Add the class striped to add stripes to the table.
Note: use tables only to display table data. Do not use tables to create layout. CSS should be used to create layout. Ask for help if you're not sure.
Note: do not use sfe-table with datatables. See the datatables section for more details.
Note: You can control the alignement of the content by adding the center or right classes on the cell.
| ID | Name | Favorite animal |
|---|---|---|
| 26326 | Harold Johnson | Alpaca |
| 83927 | Caroline Müller | Turtle |
| 25412 | Gilbert Dumont | Pigeon |
highlight
Individual rows can be highlighted with a class. highlight will highlight in blue, highlight-red will highlight in red, highlight-green will highlight in green.
Note: when using highlight-red to show errors, don't forget to wrap the field with error in a sfe-field-error to add the red halo.
| ID | Name | Favorite animal |
|---|---|---|
| 26326 | Alpaca | |
| 14847 |
This name could not be matched.
|
Penguin |
| 25412 | Pigeon | |
| 83927 | Turtle |
sfe-table selectable
Add the selectable class to the table to make it selectable.
Add a checkbox for each row. You can either use simple native checkboxes, or custom sfe-field-checkbox checkboxes. The functions for checkboxes are attached automatically to the table.
| ID | Name | Favorite animal | |
|---|---|---|---|
| 26326 | Harold McFlurpy | Alpaca | |
| 83927 | Caroline Müller | Turtle | |
| 25412 | Gilbert Dumont | Pigeon |
sfe-table table-drag-and-drop
Add the table-drag-and-drop class to the table to allow the user to reorganize its rows by drag&drop.
A new column containing the handles will be added automatically.
Note: this works for both sfe-table and sfe-flex-table. See an example for flex tables.
| ID | Name |
|---|---|
| 26326 | Harold McFlurpy |
| 83927 | Caroline Müller |
| 25412 | Gilbert Dumont |
sfe-table table-add-row
Add the table-add-row class to the table to allow the user to add rows.
Add a button with the table-delete-row-button class to a row to allow the user to delete the row.
You must set a template row for new lines with the class new-row-template.
A button with the class table-add-row-button will be used to add new rows. It must be placed in the same container as the table.
By default, an infinite amount of rows can be added. The amount of rows can be limited by the data-max-rows attribute.
Since fields usually need unique names / ID, a $counter$ placeholder can be used, which will be replaced by the line number. Refer to the example below to see it in action, each field has a unique name
Note: this works for both sfe-table and sfe-flex-table. See an example for flex tables.
| ID | Name | |
|---|---|---|
| 1 | ||
| 2 | ||
| $counter$ |
sortable
Add the sortable class to a table to make the table sortable.
The icons will be automatically added.
Add the non-sortable class to a cell header if the column should not be sortable.
Note: this works for both sfe-table and sfe-flex-table. See an example for flex tables.
| Unique ID | Name | Favorite animal |
|---|---|---|
| 1004 | Harold Johnson | Alpaca |
| 1003 | Caroline Müller | Turtle |
| 82 | Gilbert Dumont | Pigeon |
filterable
Add the filterable class to a column header to make that column filterable.
A text field will be added to the column header. If the user types something in this field, the table will be filtered to show only rows that contains this value in said column.
Note: this works for both sfe-table and sfe-flex-table. See an example for flex tables.
| Unique ID | Name | Favorite animal |
|---|---|---|
| 1004 | Harold Johnson | Alpaca |
| 1003 | Caroline Müller | Turtle |
| 1007 | Gilbert Dumont | Pigeon |
| 1245 | Brian Chase | Hamster |
| 1018 | Mark Gunther | Sloth |
| 1043 | Robert Peterson | Elephant |
paged
Add the paged class to a table to add an automatic pagination.
The number of items per page is 50 by default. If necessary, it can be controled with the data-items-per-page attribute to change it.
Additional controls for the table should be displayed in a container with the sfe-buttons-next-to-pagination class above the table. This container will always be displayed at the right position, regardless if a pagination is present or not.
Note: When using with on striped table, it is recommended to avoid odd numbers for the items per page, as it causes display issues (first row on even pages will be same color as header).
Note: The number of results will always be shown, but the pagination will not be shown if there's only one page. To force the pagination to be shown even when there is only one page, add a data-force-pagination="true" attribute to the table.
Note: this works for both sfe-table and sfe-flex-table. See an example for flex tables.
| Name |
|---|
| Juliette Danielle |
| Tommy Wiseau |
| Harold McFlurpy |
| Francesca Monterosa |
| Gilbert Dumont |
| Roger Taylor |
| Antonio Spaghetti |
| Hubert de Montmirail |
| Maria Bueno |
| Mary-Ann Eisel |
| Peter Curtis |
| Grigori Yefimovich Rasputin |
| Robert Lutz |
| Heinz Günthardt |
| Alexander Volkov |
| Philippe Coutinho Correia |
A callback function can be attached to the table with the method table.setPaginationCallback(function). This function will be fired each time the user changes the pages.
| Name |
|---|
| Juliette Danielle |
| Tommy Wiseau |
| Harold McFlurpy |
| Francesca Monterosa |
| Gilbert Dumont |
| Roger Taylor |
| Antonio Spaghetti |
| Hubert de Montmirail |
| Maria Bueno |
| Mary-Ann Eisel |
| Peter Curtis |
If creating tables with the datatables library, do not use any of the sfe classes.
Instead, simply include datatables.css to your page. This will apply the styles to give the right aspect to the tables.
sfe-flex-table
Flex tables give more functionalities and flexibility for complex sets of data. They are built with the CSS flexbox model, rather than traditional HTML tables.
Those are the functionalities that flex tables have compared to basic tables:
The column width can be controled with the classes below. The classes must be applied to each cell. It's recommended to have at least one cell-size-l column per table, since only those can handle width variations.
cell-size-xs: 40pxcell-size-s: 80pxcell-size-s: 160pxcell-size-l: 320px - the column width will adapt depending on the screen sizeNote: The alignement of the content can be controled by adding the center or right classes on the cell.
The flex table HTML element can be interacted with using a number of javascript methods:
reset()setLoading(state)injectNewResults(html, total_count)updateNumbers()appendResults()getSelection()getSelectionIDs()addRow()updateAddRowButton()addDragAndDrop()sfe-flex-table allow-multiline
By default, the content of a row is limited to one line, and the rest is cut with ellipsis.
Add the allow-multiline class on a table to allow the content to go on several lines. The class can also be added on an individual cell if needed.
sfe-flex-table selectable
Here is an example of a selectable flex-table with an action bar.
The action bar contains the batch actions to apply the selection. It is only displayed when at least one row of the table is selected.
The content of the action bar can be styled using the page's custom CSS.
The total of items in the table / in the set / currently selected is automatically updated when put in elements with the following classes:
selected-result-countdisplayed-result-counttotal-result-countCheck the HTML comments in the example below for more information.
sfe-flex-table table-drag-and-drop
This is an example for drag and drop on a flex table. See the table drag and drop documentation.
Note: if several rows have to be moved together with drag and drop (for example because of inline details), put the rows into a .row-group element.
sfe-flex-table table-add-row
This is an example for an editable flex table. See the editable table documentation.
sfe-flex-table sortable
This is an example for a sortable flex table. See the sortable table documentation.
filterable
This is an example for a sortable flex table. See the column filter documentation.
Hidden rows with additional details can be added. To toggle the row's display, use an element with the .inline-details-toggle class in the parent row.
The .inline-details-toggle can be put on a link, a button, or a .sfe-toggle-more component, as in the example below.
Note: when having hidden details rows in a striped table, use the .striped-double instead .striped class ( one out of every 4 rows must be highlighted instead of every other row).
Note: when using with a sortable table or pagination, always use a row-group element around the row pairs, otherwise the sort function will fail and rows might not be paired together anymore.
There are three ways to link a inline-details-toggle with a detail row, as detailed below.
Put the row and its inline-details together in a row-group parent element.
Add a data-toggle-target attribute containing the ID of the target row on the inline-details-toggle element.
Note: using this method, you can use more than one detail row by detail row.
If none of the above methods are set, the ID specified in the data-row-id attribute of the parent row data element will be used. The inline-details row should have a inline-details-1234 ID attribute, where "1234" is the ID of the row.
The .inline-details-toggle doesn't have any styling by itself, and can be put on any element such as a button, a link, or ideally or a .sfe-toggle-more component.
Any element with the .inline-details-toggle-all class will open / close all the inline details in the same column of the table.
sfe-flex-table actions
Optional controls for each row can be added in an element with the actions class within the row.
Those controls will only be displayed on rollover.
Try hovering a line to see the inline buttons
paged
This is an example for pagination on a flex table. See the automatic pagination documentation.
table-reorder-columns
Add the table-reorder-columns class to a table to make the columns sortable by drag and drop.
The columns order is automatically saved to the user's local storage and applied on page load.
Note: add the fixed-column class to a column header to make the column unmoveable.
Note: The ID of the table is used as key for the settings saved in local storage. If the table has no ID, a hash is created using the header's content. This means changing the header on a table with no ID will reset the settings for all users.
layout-control-density-switch, layout-control-stripe-switch, layout-control-columns-list
Add empty divs with the following classes to add controls for the table styling. The divs will be automatically filled with the correct markup.
layout-control-columns-list lets the user control which colums are displayed. When the user moves columns, the position of the checkboxes is also changed
layout-control-density-switch lets the user control the information density of the table.
layout-control-stripe-switch lets the user control whether the table is striped or not.
The table settings are automatically saved to the user's local storage and applied on page load.
Note: those divs must be somewhere in the table's parent node to work.
Note: add the fixed-column class to a column header to prevent the user from hiding a column.
Note: The ID of the table is used as key for the settings saved in local storage. If the table has no ID, a hash is created using the header's content. This means changing the header on a table with no ID will reset the settings for all users.
Note: those controls fit particularly well in a sfe-dropdown-panel above the table.
table.addCallback(hook, function)
It's possible to extend the table functionalities using hooks and callback functions.
The first argument is a string with the name of the hook. See the list below.
The second argument is the callback function itself. The table will be passed as argument to the callback function.
List of hooks:
Note: New hooks can be added easily if needed. Please consult with the UI team.
sfe-modal lightbox
Creating a modal is trivial and doesn't require to write any JavaScript in its simplest form.
It takes two components: a modal trigger (typically a button) and the modal itself.
Any element can be made a trigger by simply adding the sfe-open-modal to it. The ID of the related modal must be in the data-modal-target attribute.
The modal itself can be placed anywhere in the dom. It will be hidden by default, and displayed when the user clicks the trigger.The modal must be identified by a unique ID attribute. It can contain anything, most notably forms.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
In the following example, the modal is open via a custom javascript function attached to the button.
The code below is the simplest way to open a modal in Javascript.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
sfe-modal contextual
Works the same as a lightbox, but doesn't obscure the screen. This is better for user experience, as it doesn't interrupt the user flow. It will opens jest below or above the trigger that opened the modal, depending on the position in the window.
The first example works without javascript:
Note: When the modal contains a field, add the modal-focus-field class to focus on it automatically when the modal opens. This will save users a click.
This is a really basic example that simply opens a modal. No javscript is required to make it work.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
This example works with javascript.
The open function is attached to the trigger button, and a custom function that triggers a notification is attached to the action button:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
sfe-search-builder sfe-search-condition
Use this component to compose complex searches out of individual conditions, such as on the order list.
Each condition shows a field and its value. Clicking a condition opens a contextual modal to edit it, and the cross that appears on hover removes it.
Link a condition to its modal with the sfe-open-modal class and the data-modal-target attribute. Add the no-condition class to the operation element when the field isn't filtering anything.