Cr Component Reference

Table of Contents


Introduction

Syntax

tml`
	<Cr>
		...
	</Cr>
`

The Cr component represents a row in RowCard Component. It can contain pairs of Cl (label) and Cv (value) components, but it can contain other components instead. It may also contain a Cm (message) component, which is rendered below the other content in the row.

The Cr component inherits the colStyle and rowStyle attributes from its parent RowCard component. However, the Cr component's colStyle and rowStyle attributes may override this.

The Cr component also supports show and hide attributes. When these are used, the Cr component will show or hide the entire row when conditions specified by the show or hide attributes are true. These attributes take the same values as the hasValue attribute for ShowWhen.

Attributes

Instance methods

These methods are intended to be used by parent components to dynamically change the properties of the rendered components without re-rendering.

Inherited methods

Children

The Cr component accepts pairs of Cl (label) and Cv (value) components, or other children. It accepts a single Cm (message) component.

DOM element properties

The Cr Component renders differently depending on whether show or hide attributes prevent row rendering, or a Cm component is present in the children.

If the show or hide attributes prevent row rendering, then the component will render a marker <span>; see the When Component Reference.

If there is a Cm component in the children:

If there is no Cm component in the children, the row content is combined into a single div:

Styling

By default, each row within a Card is separated by a var(--main-fill-color) line.

By default, the card_row-main <div>, is styled using a flexbox. Each Cl and Cv element will grow and shrink to share the space equally. The app can change the width of the columns in a specific Card by adding a className for the card and adjusting the flexbox parameters for a specific child in the page's CSS file. For example:

Template returned by myPage's render() function in myPage.js:

<Page>
	<Card className=myCard>
		<Cr>
			<Cl>Label 1A</> <Cv>Value 1A</> 
			<Cl>Label 1B</> <Cv>Value 1B</>
		</Cr>
		<Cr>
			<Cl>Label 2A</> <Cv>Value 2A</> 
			<Cl>Label 2B</> <Cv>Value 2B</>
		</Cr>
	</Card>
</Page

Note: the container for myPage has class myPage. In myPage.css:

.myPage .myCard .card_label:first-child {
	/* fix the first column at 35% of the row width */
	flex: 0 0 35%;
}