<div id="card-container"></div>
function titleText (title, text) {
return hx.card.section()
.add(hx.detached('div')
.add(hx.card.title({text: title})))
.add(hx.detached('div')
.add(hx.card.text({text: text})))
}
function sparkline (options) {
return hx.card.group()
.add(hx.card.fixed.section().add(hx.card.text({text: options.text})))
.add(hx.card.section().add(hx.sparkline({strokeColor: options.sparklineColor, data: options.sparklineData})))
}
function random (i) {
return {
x: i,
y: Math.random()
}
}
function statusCard (name, context) {
return hx.card()
.add(hx.card.header.section({ context: context})
.add(hx.card.title({text: name})))
.add(hx.card.header.group()
.add(titleText('Status', 'Normal'))
.add(titleText('Uptime', '5 days'))
.add(titleText('Memory Usage', '482 MB'))
.add(titleText('Thread Count', '19'))
.add(titleText('Page Hits', '2236 / s')))
.add(hx.card.aligned()
.add(sparkline({text: 'Memory Use', sparklineColor: hx.theme().plot.colors[0], sparklineData: hx.range(60).map(random)}))
.add(sparkline({text: 'Thread Count', sparklineColor: hx.theme().plot.colors[1], sparklineData: hx.range(60).map(random)}))
.add(sparkline({text: 'Page Hits', sparklineColor: hx.theme().plot.colors[2], sparklineData: hx.range(60).map(random)}))
.add(sparkline({text: 'Messages Processed', sparklineColor: hx.theme().plot.colors[3], sparklineData: hx.range(60).map(random)})))
}
hx.select('#card-container')
.add(statusCard('Instance 1', undefined))
.add(statusCard('Instance 2', 'positive'))
.add(statusCard('Instance 3', 'negative'))
hx-card
class applied hx-card-small
class applied to make the padding inside all child hx.card.section()
elements smaller. hx-card
selection hx-card-small
, hx-card-normal
or hx-card-slim
class to the group. hx.card.small()
hx.card()
hx-card-fixed
class to the group to prevent it from expanding to take up the available space. hx-card-joint
class to join the group to the next group/section hx-card-header
class to the group to display the group as a header // Default groups
hx.card.group()
hx.card.fixed.group()
hx.card.fixed.joint.group()
hx.card.fixed.vertical.group()
hx.card.fixed.header.group()
hx.card.fixed.joint.vertical.group()
hx.card.fixed.joint.header.group()
hx.card.fixed.joint.vertical.header.group()
hx.card.fixed.vertical.header.group()
hx.card.joint.group()
hx.card.joint.header.group()
hx.card.joint.vertical.group()
hx.card.joint.vertical.header.group()
hx.card.vertical.group()
hx.card.vertical.header.group()
hx.card.header.group()
// Small groups
hx.card.small.group()
hx.card.small.fixed.group()
hx.card.small.fixed.joint.group()
hx.card.small.fixed.vertical.group()
hx.card.small.fixed.header.group()
hx.card.small.fixed.joint.vertical.group()
hx.card.small.fixed.joint.header.group()
hx.card.small.fixed.joint.vertical.header.group()
hx.card.small.fixed.vertical.header.group()
hx.card.small.joint.group()
hx.card.small.joint.header.group()
hx.card.small.joint.vertical.group()
hx.card.small.joint.vertical.header.group()
hx.card.small.vertical.group()
hx.card.small.vertical.header.group()
hx.card.small.header.group()
// Normal groups
hx.card.normal.group()
hx.card.normal.fixed.group()
hx.card.normal.fixed.joint.group()
hx.card.normal.fixed.vertical.group()
hx.card.normal.fixed.header.group()
hx.card.normal.fixed.joint.vertical.group()
hx.card.normal.fixed.joint.header.group()
hx.card.normal.fixed.joint.vertical.header.group()
hx.card.normal.fixed.vertical.header.group()
hx.card.normal.joint.group()
hx.card.normal.joint.header.group()
hx.card.normal.joint.vertical.group()
hx.card.normal.joint.vertical.header.group()
hx.card.normal.vertical.group()
hx.card.normal.vertical.header.group()
hx.card.normal.header.group()
// Slim groups
hx.card.slim.group()
hx.card.slim.fixed.group()
hx.card.slim.fixed.joint.group()
hx.card.slim.fixed.vertical.group()
hx.card.slim.fixed.header.group()
hx.card.slim.fixed.joint.vertical.group()
hx.card.slim.fixed.joint.header.group()
hx.card.slim.fixed.joint.vertical.header.group()
hx.card.slim.fixed.vertical.header.group()
hx.card.slim.joint.group()
hx.card.slim.joint.header.group()
hx.card.slim.joint.vertical.group()
hx.card.slim.joint.vertical.header.group()
hx.card.slim.vertical.group()
hx.card.slim.vertical.header.group()
hx.card.slim.header.group()
var group = hx.card.group()
var api = group.component()
hx-card-small
hx-card-normal
or hx-card-slim
class to the section. hx.card.small()
hx.card()
hx-card-fixed
class to the section to prevent it from expanding to take up the available space. hx-card-joint
class to join the section to the next group/section hx-card-header
class to the section to display the section as a header // Default sections
hx.card.section()
hx.card.fixed.section()
hx.card.fixed.joint.section()
hx.card.fixed.header.section()
hx.card.fixed.joint.header.section()
hx.card.joint.section()
hx.card.joint.header.section()
hx.card.header.section()
// Small Sections
hx.card.small.section()
hx.card.small.fixed.section()
hx.card.small.fixed.joint.section()
hx.card.small.fixed.header.section()
hx.card.small.fixed.joint.header.section()
hx.card.small.joint.section()
hx.card.small.joint.header.section()
hx.card.small.header.section()
// Normal Sections
hx.card.normal.section()
hx.card.normal.fixed.section()
hx.card.normal.fixed.joint.section()
hx.card.normal.fixed.header.section()
hx.card.normal.fixed.joint.header.section()
hx.card.normal.joint.section()
hx.card.normal.joint.header.section()
hx.card.normal.header.section()
// Slim Sections
hx.card.slim.section()
hx.card.slim.fixed.section()
hx.card.slim.fixed.joint.section()
hx.card.slim.fixed.header.section()
hx.card.slim.fixed.joint.header.section()
hx.card.slim.joint.section()
hx.card.slim.joint.header.section()
hx.card.slim.header.section()
var section = hx.card.section()
var api = section.component()
hx.card.aligned()
.add(hx.card.group()
.add(hx.card.section())
.add(hx.card.section())
.add(hx.card.section()))
.add(hx.card.group()
.add(hx.card.section())
.add(hx.card.section())
.add(hx.card.section()))
.add(hx.card.group()
.add(hx.card.section())
.add(hx.card.section())
.add(hx.card.section()))
hx-card-section
elements <div id="icon-example"></div>
hx.select('#icon-example')
.add(hx.card()
.add(hx.card.section()
.add(hx.card.icon({ icon: 'hx-icon hx-icon-check' })))
.add(hx.card.section()
.add(hx.card.small.icon({ icon: 'hx-icon hx-icon-check' })))
.add(hx.card.section()
.add(hx.card.large.icon({ icon: 'hx-icon hx-icon-check' })))
.add(hx.card.section()
.add(hx.card.icon({ icon: 'hx-icon hx-icon-check', context: 'negative'}))))
var icon = hx.card.icon()
var api = icon.component()
<div id="text-example"></div>
hx.select('#text-example')
.add(hx.card()
.add(hx.card.section()
.add(hx.card.text({ text: 'Normal Text' })))
.add(hx.card.section()
.add(hx.card.small.text({ text: 'Small Text' })))
.add(hx.card.section()
.add(hx.card.large.text({ text: 'Large Text' })))
.add(hx.card.section()
.add(hx.card.text({ text: 'Positive Text', context: 'positive' }))))
var text = hx.card.text()
var api = text.component()
<div id="title-example"></div>
hx.select('#title-example')
.add(hx.card()
.add(hx.card.section()
.add(hx.card.title({ text: 'Normal title' })))
.add(hx.card.section()
.add(hx.card.small.title({ text: 'Small title' })))
.add(hx.card.section()
.add(hx.card.large.title({ text: 'Large title' })))
.add(hx.card.section()
.add(hx.card.title({ text: 'Positive title', context: 'positive' }))))
var title = hx.card.title()
var api = title.component()
.hx-card-section
or .hx-card-group
as direct children. .hx-card-section
.hx-card-section
or .hx-card-group
elements. .hx-card-section
or .hx-card-group
element within a .hx-card-group
to prevent it from stretching to fill the available space. .hx-card-section
or .hx-card-group
as a card header. .hx-card-section
or .hx-card-group
with the next .hx-card-section
or .hx-card-group
element and removing the border between them. .hx-card-section
or .hx-card-group
elements to make them have the default padding. .hx-card-section
or .hx-card-group
elements to make them have less padding. .hx-card-group
into a vertical group. .hx-card-section
.hx-card-section
or .hx-card-group
element within a .hx-card-group
to prevent it from stretching to fill the available space. .hx-card-section
or .hx-card-group
as a card header. .hx-card-section
or .hx-card-group
with the next .hx-card-section
or .hx-card-group
element and removing the border between them. .hx-card-section
or .hx-card-group
elements to make them have the default padding. .hx-card-section
or .hx-card-group
elements to make them have less padding. .hx-card
to make all child .hx-card-section
elements have less padding. .hx-card-section
or .hx-card-group
elements by giving them the .hx-card-normal
(or .hx-card-slim
) class.