CSS classes of base elements
The DHTMLX library provides a set of CSS classes that you can add to HTML elements to style them in your web project outside DHTMLX widgets.
The principle of these CSS classes' naming is based on the BEM methodology.
Therefore, a class name includes three parts:
- Block name
- Element name
- Modifier name
Block names and element names are separated by a double underscore: block__element.
Block and elements' names are separated from modifier names by a double hyphen: block--modifier, block__element--modifier.
The 'dhx' prefix is used at the beginning of all class names in the DHTMLX library
The full list of CSS classes of the DHTMLX library you can use to style HTML elements is described below.
Form group
Block
Name | Description |
---|---|
dhx_form-group | Use this class to apply the same formatting to different HTML elements at once. It includes modifiers for manipulating the appearance and state of a layout. |
Modifiers
Name | Description |
---|---|
dhx_form-group--no-message-holder | Removes the bottom margin where a text for a pre-message could be placed |
dhx_form-group--disabled | A form-group has a disabled state. It can't be activated (selected, clicked on, typed into) or accept focus. |
dhx_form-group--hidden | Hides a form group visually |
dhx_form-group--required | Adds the required mark to a label inside a form group |
dhx_form-group--state_error | Marks the content of input/label red. Indicates error |
dhx_form-group--state_success | Marks the content of input/label green. Indicates success |
dhx_form-group--label_sr | Hides a label inside a form group visually |
dhx_form-group--inline | Puts a label and an input in one line |
dhx_form-group--textarea | Add this class to the form group, which contains a <textarea> element, to style it |
Here's what markup looks like using a form-group example:
<!-- Form-group block -->
<div class="dhx_form-group ">
<!-- Label block -->
<label for="input" class="dhx_label ">I am label</label>
<!-- 'wrapper' element in the 'input' block-->
<div class="dhx_input__wrapper">
<!-- 'container' element in the 'input' block-->
<div class="dhx_input__container">
<!-- Style the input-->
<input id="input" placeholder="I am input" class="dhx_input" autoComplete="off"/>
</div>
</div>
</div>
Button
Block
Name | Description |
---|---|
dhx_button | Add this class to a <button> element to reset/normalize default browser styles. |
Elements
Name | Description |
---|---|
dhx_button__icon | Container for an icon |
dhx_button__text | Container for button text/value |
dhx_button__loading | Use this class to create a container for the loading mode |
dhx_button__loading-icon | Use this class together with the "dhx_button--loading" class to create an icon container for the loading mode |
Modifiers
Name | Description |
---|---|
dhx_button--circle | Use this class either to add rounded corners to a button with value or to create a circular button that contains only an icon |
dhx_button--width_full | Add this class to adjust the width of a button to the width of its container |
dhx_button--disabled | Use this class to change the button view to disabled. Instead of this class you can add the disabled attribute. |
dhx_button--loading | Apply the loading modifier to switch the button to the loading state. Both the "dhx_button--loading" and "dhx_button__loading-icon" elements must be applied. |
dhx_button--size_small | Use this class to add a small button |
dhx_button--size_medium | Use this class to add a medium button |
dhx_button--view_flat | Use this class to create a flat button |
dhx_button--view_link | Use this class to create a link button |
dhx_button--color_primary | Blue button (#0288d1). Use this modifier together with the 'view' modifier |
dhx_button--color_secondary | Gray button (#4d4d4d). Use this modifier together with the 'view' modifier |
dhx_button--color_danger | Red button (#ff5252). Use this modifier together with the 'view' modifier |
dhx_button--color_success | Green button (#0ab169). Use this class together with the 'view' modifier |
Here is an example how you can specify a markup for a button:
<!-- Create a link button with red color-->
<button type="button" class="dhx_button dhx_button--color_danger dhx_button--view_link">
<!-- The button has the "plus" icon-->
<span class="dhx_button__icon dxi dxi-plus"></span>
<!-- The "Send text" button-->
<span class="dhx_button__text">Send</span>
</button>
Label
Block
Name | Description |
---|---|
dhx_label | Add this class to a <label> element inside a form group to style it |
You can style a <label> element, as in:
<label for="element-id" class="dhx_label">Email</label>
Checkbox
Block
Name | Description |
---|---|
dhx_checkbox | Add this class to the "dhx_form-group" class inside a <label> element to create a label for a checkbox. |
Elements
Name | Description |
---|---|
dhx_checkbox__input | Add this class to the <input type='checkbox'> element to hide a native browser checkbox but save its behavior |
dhx_checkbox__visual-input | Add this class to a <span> element to display a checkbox with its native browser behavior visually |
You can change the appearance of a native browser checkbox by using a markup given below:
<!-- Create a label for a checkbox and put it and an input in one line inside the form-group-->
<label class="dhx_form-group dhx_checkbox dhx_form-group--inline" style="margin-left: calc(116px);">
<!-- Hide a native browser checkbox but save its behavior-->
<input type="checkbox" class="dhx_checkbox__input"/>
<!-- Display the checkbox with its native browser behavior visually-->
<span class="dhx_checkbox__visual-input"></span>
<!-- Style the checkbox label-->
<span class="dhx_label ">I am checkbox</span>
</label>
Radiobutton
Block
Name | Description |
---|---|
dhx_radiobutton | Add this class to the "dhx_form-group" class inside a <label> element to create a label for a radiobutton. |
Elements
Name | Description |
---|---|
dhx_radiobutton__input | Add this class to the <input type='radiobutton'> element to hide a native browser radiobutton but save its behavior |
dhx_radiobutton__visual-input | Add this class to a <span> element to display a radiobutton with its native browser behavior visually |
You can apply a markup to style a radiobutton, like this:
<!-- Create a label for a radiobutton and put it and an input in one line inside the form-group-->
<label class="dhx_form-group dhx_radiobutton dhx_form-group--inline" style="margin-left: calc(116px);">
<!-- Hide a native browser radiobutton but save its behavior-->
<input type="radiobutton" class="dhx_radiobutton__input"/>
<!-- Display the radiobutton with its native browser behavior visually-->
<span class="dhx_radiobutton__visual-input"></span>
<!-- Style the radiobutton label-->
<span class="dhx_label ">I am radiobutton</span>
</label>
Input
Block
Name | Description |
---|---|
dhx_input | Add this class to an <input type='text'> element to style it |