Table
Properties related to table container.
tableStyle
- Type:
CSSStyle
Object containing CSS styling properties for the table element.
Example
- Sample code
- Full code
<active-table
tableStyle='{
"borderRadius": "10px",
"boxShadow": "rgb(172 172 172 / 17%) 0px 0.5px 1px 0px",
"width":"100%"
}'
></active-table>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<active-table
tableStyle='{
"borderRadius": "10px",
"boxShadow": "rgb(172 172 172 / 17%) 0px 0.5px 1px 0px",
"width":"100%"
}'
data='[
["Planet", "Diameter", "Mass", "Moons","Density"],
["Earth", 12756, 5.97, 1, 5514],
["Mars", 6792, 0.642, 2, 3934],
["Saturn", 120536, 568, 82, 687],
["Neptune", 49528, 102, 14, 1638]]'
></active-table>
When table width
needs to inherit the parent element width, set width
to 100% as displayed in the example.
minWidth
, height
, minHeight
, maxHeight
properties are not supported.
overflow
- Type: {
maxWidth?: string
,maxHeight?: string
} - Default: unset
A scrollbar is introduced on the table if either of the specified dimensions are exceeded. The use of this object automatically sets
stickyHeader
to true which can be set back to false if required.
Example
- Sample code
- Full code
<active-table overflow='{"maxHeight": "298px", "maxWidth": "100%"}' tableStyle='{"width":"1000px"}'></active-table>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<active-table
overflow='{"maxHeight": "298px", "maxWidth": "100%"}'
tableStyle='{"width":"1000px"}'
data='[
["Planet", "Diameter", "Mass", "Moons", "Density"],
["Earth", 12756, 5.97, 1, 5514],
["Mars", 6792, 0.642, 2, 3934],
["Jupiter", 142984, 1898, 79, 1326],
["Saturn", 120536, 568, 82, 687],
["Neptune", 49528, 102, 14, 1638],
["Mercury", 4879, 0.33, 0, 5429],
["Venus", 12104, 4.87, 0, 5243],
["Uranus", 51118, 86.8, 27, 1270],
["Pluto", 2376, 0.013, 5, 1850],
["Moon", 3475, 0.073, 0, 3340]]'
></active-table>
frameComponentsStyles
- Type: {
styles?: HoverableStyles
,
inheritHeaderColors?: boolean
} - Default: { inheritHeaderColors: true }
Frame components are the index column, add new column and the add new row. This property is used to set their styling.
The styles
property defines components' styling for varying mouse states.
inheritHeaderColors
is used to toggle whether the header cells of the index column and the add new column would inherit the header
row's backgroundColor
and text color
.
Example
- Sample code
- Full code
<active-table
frameComponentsStyles='{
"styles": {
"default": {"backgroundColor": "#f5f5f5"},
"hoverColors": {"backgroundColor": "#dedede"}},
"inheritHeaderColors": false
}'
></active-table>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<active-table
frameComponentsStyles='{
"styles": {
"default": {"backgroundColor": "#f5f5f5"},
"hoverColors": {"backgroundColor": "#dedede"}},
"inheritHeaderColors": false
}'
data='[
["Planet", "Diameter", "Mass", "Moons", "Density"],
["Earth", 12756, 5.97, 1, 5514],
["Mars", 6792, 0.642, 2, 3934],
["Jupiter", 142984, 1898, 79, 1326],
["Saturn", 120536, 568, 82, 687],
["Neptune", 49528, 102, 14, 1638]]'
tableStyle='{"borderRadius":"2px"}'
></active-table>
enterKeyMoveDown
- Type:
boolean
- Default: false
When the user presses the ENTER key, the cursor focus is moved to the cell below.
Example
- Sample code
- Full code
<active-table enterKeyMoveDown="true"></active-table>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<active-table
enterKeyMoveDown="true"
data='[
["Planet", "Diameter", "Mass", "Moons", "Density"],
["Earth", 12756, 5.97, 1, 5514],
["Mars", 6792, 0.642, 2, 3934],
["Jupiter", 142984, 1898, 79, 1326],
["Saturn", 120536, 568, 82, 687],
["Neptune", 49528, 102, 14, 1638]]'
tableStyle='{"borderRadius":"2px"}'
></active-table>
The autofocus does not work in the Safari browser.
auxiliaryStyle
- Type:
string
This is primarily used to configure Webkit CSS
which cannot be added through component's style properties. A great
example of this is the ::-webkit-scrollbar
pseudo element which affects the style of the table's scrollbar.
Example
- Sample code
- Full code
<active-table
auxiliaryStyle="
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-thumb {
background-color: #54a7ff;
border-radius: 5px;
}"
></active-table>
<!-- This example is for Vanilla JS and should be tailored to your framework (see Examples) -->
<active-table
auxiliaryStyle="
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-thumb {
background-color: #54a7ff;
border-radius: 5px;
}"
overflow='{"maxHeight": "298px", "maxWidth": "100%"}'
tableStyle='{"width":"1000px"}'
data='[
["Planet", "Diameter", "Mass", "Moons", "Density"],
["Earth", 12756, 5.97, 1, 5514],
["Mars", 6792, 0.642, 2, 3934],
["Jupiter", 142984, 1898, 79, 1326],
["Saturn", 120536, 568, 82, 687],
["Neptune", 49528, 102, 14, 1638],
["Mercury", 4879, 0.33, 0, 5429],
["Venus", 12104, 4.87, 0, 5243],
["Uranus", 51118, 86.8, 27, 1270],
["Pluto", 2376, 0.013, 5, 1850],
["Moon", 3475, 0.073, 0, 3340]]'
></active-table>
If your Webkit CSS
properties affect element widths or heights, they may result in undesirable component dimensions.
Please use them with caution.
Webkit CSS
is not standardised across all browsers, make sure to check browser support
for the property you are using.