The skins in dgrid 1.0 are implemented using Stylus, and are designed to be
easily extensible. All skins consist primarily of a series of variable definitions, which are used by
skin.styl
to generate commonly-used styles.
In order to further customize dgrid skins externally to dgrid itself, you will need to either install Stylus and Nib
globally (i.e. npm i -g stylus nib
), or implement a workflow (e.g. via npm scripts or Grunt) which incorporates them
as dependencies (see dgrid's package.json
and Gruntfile.js
for example).
If running stylus from the command line, you will need to pass -u nib
in order for requires/imports of nib components
to work.
The following is the general format for skins, and can be followed to create new skins as well:
@require 'nib/gradients'; // Include if you intend to use CSS gradients
@require 'nib/vendor'; // Include for automatic vendor prefixing
// Define variables here
.yourskinclass {
@import 'dgrid/css/skin/skin'; // Generate styles based on defined variables
// Include any extra specific styles not covered by skin.styl here
}
See dgrid/css/skin.styl
for supported variables.
Each of the included skins uses the conditional assignment operator (?=
) when defining its variables. This makes
overriding skin variables in Stylus as easy as defining your own values prior to including the skin:
// You can optionally use conditional assignment as well to make your own extensions extensible
$dgrid-body-row-odd-background ?= #e7f0f7;
@import 'dgrid/css/skin/slate';
The following is a list of commonly-used dgrid CSS classes:
dgrid
: The top-level element of each List or Griddgrid-header
: The element containing the header rowdgrid-header-scroll
: The element in the top-right corner of a Grid (or top-left for RTL), above the vertical scrollbardgrid-footer
: The (optional) element at the bottom of the grid (e.g. used for Pagination controls)dgrid-scroller
: The element responsible for scrolling the grid's datadgrid-content
: The element inside of the scroller area, which displays all of the datadgrid-row
: Each row elementdgrid-row-even
: Each even row elementdgrid-row-odd
: Each odd row element; applying a different color to alternating rows can help visually distinguish individual itemsdgrid-cell
: Each cell elementdgrid-selected
: Each selected row or celldgrid-focus
: The focused element (row or cell); added by the Keyboard mixindgrid-expando-icon
: The expando icon in Tree cellsdgrid-row-expandable
: Added to parent rows that can be expanded with theTree
mixindgrid-row-expanded
: Added to parent rows that have been expanded when using theTree
mixin
When addUiClasses
is set to true
(the default), the following generic class
names are also available for generic skinning (following the jQuery ThemeRoller convention):
ui-widget-content
: Applied to each dgrid list or grid at the top elementui-widget-header
: Applied to the element that contains the header renderingui-state-default
: Applied to each row elementui-state-active
: Applied to selected rows or cellsui-state-highlight
: Applied to a row for a short time when the contents are changed (or it is newly created)