terra-component-lib
v1.0.100
Published
The Terra React Component Library is built using the Trimble SketchUp Terra Style Design System.
Downloads
505
Keywords
Readme
Terra React Component Library
The Terra React Component Library is built using the Trimble SketchUp Terra Style Design System.
This version of Terra is used by Luna v. 0.x and MEP.
Terra React Storybook
You can find the Storybook site for Terra's React component library here.
Terra Design System Website
The design system website for Terra can be found here.
Getting Started
To get started with Terra, install it in your project from the command line with:
npm install --save terra-component-lib
To use components from Terra in your React project, destructure them in your component file. Example:
import { Button } from 'terra-component-lib';
You can then use the imported Terra component within your own application.
Components
Atoms
Button
Props -
onClick
(required) - function that determines the method called when the button is clicked taking an argument of the event objectclassName
- string that determines the type of button (see options), interpolates into componentclassName
, defaults to Primary 1text
(required) - string that determines the inner text of the button elementname
- string used for the check box's name for parent state managementurl
- string used for generating either an<a>
tag (starts withhttp
) or React Router<NavLink>
######className
options -
- Primary 1 -
"ter-button-primary--1"
- Primary 2 -
"ter-button-primary--2"
- Primary 3 -
"ter-button-primary--3"
- Primary 4 -
"ter-button-primary--4"
- Primary 5 -
"ter-button-primary--5"
- Secondary 1 -
"ter-button-secondary--1"
- Secondary 2 -
"ter-button-secondary--2"
- Secondary 3 -
"ter-button-secondary--3"
- Secondary 4 -
"ter-button-secondary--4"
- Secondary 5 -
"ter-button-secondary--5"
- Small Button -
"ter-button--small"
Example -
<Button
text="Button"
onClick={this.handleClickOne}
className="ter-button--primary--1"
/>
<Button
text="Button"
onClick={this.handleClickTwo}
className="ter-button--secondary--2 ter-button--small"
/>
ButtonLink
Props -
url
(required) - string that provides the markup necessary to populate thehref
of an<a>
tag or theto
of a React Router<NavLink>
. The tag generated is based on the string the passed in. Anything starting withhttp
will render an<a>
tag while anything starting with/
will render a<NavLink>
.className
(required) - string that determines the type of button (see options) - interpolates into componentclassName
- see options belowtext
(required) - string that determines the inner text of the button element
######className
options -
- Primary 1 -
"ter-button-primary--1"
- Primary 2 -
"ter-button-primary--2"
- Primary 3 -
"ter-button-primary--3"
- Primary 4 -
"ter-button-primary--4"
- Primary 5 -
"ter-button-primary--5"
- Secondary 1 -
"ter-button-secondary--1"
- Secondary 2 -
"ter-button-secondary--2"
- Secondary 3 -
"ter-button-secondary--3"
- Secondary 4 -
"ter-button-secondary--4"
- Secondary 5 -
"ter-button-secondary--5"
- Small Button -
"ter-button--small"
Example -
<Button
text="Button"
url='www.hello.com'
className="ter-button--primary--1"
/>
<Button
text="Button"
url='www.hello.com'
className="ter-button--secondary--2 ter-button--small"
/>
Header
Props -
text
(required) - string for generating header textfontSize
- string for determining font size, defaults to 'lg', see Terra documentation for variable syntaxfontWeight
- string for determing font weight, defaults to 'extra-bold', see Terra documentation for variable syntaxcolor
- string for determining color, defaults to 'black', see Terra documentation for variable syntax- 'align' - string for determining alignment, defaults to 'center', see Terra documentation for variable syntax
Example -
<Header text='I am a Header' fontSize='xl' fontWeight='bold' color='brand-1' align='start' />
HeadshotDumpling
Props -
image
(required) - object withurl
andaltText
string key/valuesheader
(required) - text string for generating the primary text, generally a namesubHeader
- text string for generating the secondary text, generally locationtext
- string for generating description/body text, generally job titlefilter
- string for creating a filter for the image, accepts'grayscale'
and'blue'
Example -
<HeaderShotDumpling
image={{url:'./test.png', altText='alt text'}}
header='Name'
subHeader='Location'
text='Incididunt veniam reprehenderit eu sit qui.'
filter='blue'
/>
ArticleCard
Props -
image
(required) - object withurl
andaltText
string key/valuesheader
(required) - text string for generating the primary text, generally a namelink
(required) - string of a URL to link the card tocategory
(required) - string for generating category of node text
Example -
<ArticleCard
link="/#"
header="This is an article card"
category="Category"
image={{url:'./test.png', altText='alt text'}}
/>
EventCard
Props -
header
(required) - text string for generating the primary text, generally an event namedate
(required) - text string for a datevenue
(required) - text string for a venuelocation
(required) - text string for a locationctaOne
(required) - object with aurl
andtext
string key/valuesctaTw0
- object with aurl
andtext
string key/values
Example -
<EventCard
header="This is an event card"
date="May 25, 2019"
venue="Venue"
location="Location"
ctaOne={ url: "/", text: "Register" }
ctaTwo={ url: "/", text: "Event Website" }
/>
HeadshotDumplingContainer
Props -
dumplings
(required) - an array of objects used for generating<HeadshotDumplings>
. Each object requires theimage
andheader
key/values with options forsubHeader
andtext
.filter
- Used for setting the default filter type for all dumplings in the container.
Example -
const dumplings = [
{
image: {
url: "./jeffshot.png",
altText: "Jeff Goldblum"
},
header: "Jeffrey Lynn Goldblum",
subHeader: "United States",
text: "Actor, Musician, International Man of Mystery"
},
{
image: {
url: "./jeffshot.png",
altText: "Jeff Goldblum"
},
header: "Jeffrey Lynn Goldblum",
subHeader: "United States",
text: "Actor, Musician, International Man of Mystery"
}
]
<HeadshotDumplingContainer dumplings={dumplings} variant='grayscale' />
SubHeader
Props -
text
(required) - string for generating header textfontSize
- string for determining font size, defaults to 'md', see Terra documentation for variable syntaxfontWeight
- string for determing font weight, defaults to 'normal', see Terra documentation for variable syntaxcolor
- string for determining color, defaults to 'gray-7', see Terra documentation for variable syntax- 'align' - string for determining alignment, defaults to 'center', see Terra documentation for variable syntax
Example -
<SubHeader text='I am a Header' fontSize='xl' fontWeight='bold' color='brand-1' align='start' />
Text
Props -
text
(required) - string for generating header textfontSize
- string for determining font size, defaults to 'base', see Terra documentation for variable syntaxfontWeight
- string for determing font weight, defaults to 'normal', see Terra documentation for variable syntaxcolor
- string for determining color, defaults to 'black', see Terra documentation for variable syntax- 'align' - string for determining alignment, defaults to 'start', see Terra documentation for variable syntax
Example -
<Text text='I am text' fontSize='xl' fontWeight='bold' color='brand-1' align='start' />
Tooltip
Props -
direction
(required)- string indicating the direction that the Tooltip will render relative to its hover texttoolTipLabel
(required)- string used for generating the text that the user will hover over to display the Tooltipchildren
(required)- components rendered inside the Tooltip, should be nested within the component itself
######direction
options -
- Up -
"up"
- Down -
"down"
- Right -
"right"
- Left -
"left"
Example -
<Tooltip direction="up" tooltipLabel="I am a tooltip">
<p>I am the inner content within a tooltip</p>
<a href='www.link.com'>Link</a>
</Tooltip>
Molecules
Accordion
Props -
AccordionFold
(required) - child component that needs to be imported with Accordion that you use to render its inner content. EachAccordionFold
takes a single prop ofheader
set equal to a string.defaultActive
- number indicating the index of the active accordion 'fold' on load.
Example -
<Accordion defaultActive=[0] >
<AccordionFold header="Fold Two">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</p>
</AccordionFold>
<AccordionFold header="Fold Two">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
</p>
</AccordionFold>
</Accordion>
Alert
Props -
onClick
(required) - determines the method called when the 'close' button is clickedtext
(required) - determines the text displayed in the alerttype
- determines the type of alert
Example -
<Alert onClick={this.closeAlert} text="Warning Alert!" type="warning" />
ArticleCard
Props -
link
- (required) - url string for the article's linkheader
- **(required) - string for generating header textcategory
- **(required) - string for generating category textimage
- object withurl
andaltText
strings for generating an<img>
element
Example -
<ArticleCard link='/#' header='Header Text' category='category text' image={{url: '/#', altText: 'description}}
Breadcrumbs
Props -
breadcrumbs
(required) - an array of objects for generating breadcrumbtext
andurl
strings.
Example -
<Breadcrumbs
breadcrumbs=[{text: 'link one', url:'www.example.com'}, {text: 'link two', url:'www.link.com}]
/>
Card
Props -
image
(required) - object consisting of aurl
andaltText
key/value pairs (strings) used to create a link to the image location and the alt description text for the imagefallbackImage
- reference to a fallback image to be used if the original image source is brokenheader
(required) - string used to determine the title for the cardtext
- an array of strings used to generate body textbutton
- an object consisting of anonClick
function, atext
string, and aname
string used for populating a<Button>
component.buttonLink
- an object consisting ofurl
andtext
strings for populating a<ButtonLink>
componentlink
- an object consisting of aurl
andtext
strings as key/values for an<a>
elementcategory
- string used for labeling the card's categoryinsertHTML
- boolean that indicates whether thetext
prop should be inserted as innerHTML (true) or simply passed as a text string to a<p>
tag.motion
- boolean that indicates whether to use thereact-reveal
library to render the component inside a<Fade>
component.motionDirection
- string indicating the direction that the component should travel from as it fades inmotionDelay
- string in milliseconds indicating how long the delay should be before motion occursmotionDistance
- string indicating the distance that the component travels during motion
Example -
<Card
title="I am a card title"
text={["I am sample card text", "So am I"]}
image={url:"www.cat.com/cat.png", altText:"a cat"}}
link={{url:"www.iamalink.com", text:"link to a link"}}
button={{onClick: this.buttonClick, text: 'button', name: 'buttonOne'}}
buttonLink={{url: '/home', text: 'Home'}}
category="cats"
/>
Checkbox
Props -
label
(required) - string used for the check box's labelname
(required) - string used for the check box's name for parent state managementchecked
(required) - boolean used to indicate whether or not the checkbox is checked, you should use whatever state property cooresponds to the component'sname
handleChange
(required) - function called when the checkbox is changed, best used for changing thechecked
state, takes a single argument of the the event object.
Example -
<Checkbox
label='check box'
name='checkBoxOne'
handleChange={this.toggleCheckBox}
checked={this.state.checkBoxOne}
/>
CTALinkSection
Props -
ctas
(required) - a single object containing data for three different CTAs.ctaOne
andctaTwo
are keys within the object that have their own key/values oftext
for generating the cta's text,className
for determining the button type to generate (see<ButtonLink>
), andurl
for generating a link, The third key is for thesubCTA
, which hastext
andurl
strings.
Example -
const ctas = {
ctaOne: {
text: 'Home',
className='ter-button--primary--1',
url: '/'
},
ctaTwo: {
text: 'About',
className='ter-button--secondary--1',
url: '/about'
},
subCTA: {
text; 'Contact',
url: '/contact'
}
}
<CTALinkSection ctas={ctas} />
CTARow
Props -
ctaOne
(required) - object consisting ofurl
andtext
strings for generating a<ButtonLink>
ctaTwo
(required) - object consisting ofurl
andtext
strings for generating a<ButtonLink>
Example -
const ctaOne = {
url: '/test/two',
text: 'Test 1'
}
const ctaTwo = {
url: '/test/one',
text: 'Test 2'
}
<CTARow ctaOne={ctaOne} ctaTwo={ctaTwo} />
CTASection
Props -
ctas
(required) - a single object containing data for three different CTAs.ctaOne
andctaTwo
are keys within the object that have their own key/values oftext
for generating the cta's text,className
for determining the button type to generate (see<Button>
), andonClick
for the associated called function, andname
for parent component association with the clicked button (again, see<Button>
), The third key is for thesubCTA
, which hastext
andurl
strings for generating a simple<a>
tag.
Example -
const ctas = {
ctaOne: {
text: 'Home',
className='ter-button--primary--1',
onClick: this.homeButtonClick,
name: 'homeBtn'
},
ctaTwo: {
text: 'About',
className='ter-button--secondary--1',
onClick: this.aboutButtonClick,
name: 'aboutBtn'
},
subCTA: {
text; 'Contact',
url: '/contact'
}
}
<CTASection ctas={ctas} />
Dropdown
Props -
options
(required) - array of strings used for generating dropdown optionshandleSelection
(required) - function used for changing the currently selection, takes two arguments of the new selection and the component'sname
propselection
(required) - string indicating the current dropdowndefaultText
(required) - string indicating the default text in the selected fieldname
(required) - string used for parent processing of the component
Example -
<Dropdown
options={['red', 'blue', 'yellow']}
handleSelection={this.selectColor}
selection={this.state.color}
defaultText='Select a color'
name='color'
/>
Dumpling
Props -
title
(required) - string that is used to generate the title textlink
(required) - object with aurl
key/value pair used to provide thehref
value for the<a>
tag orto
for a<NavLink>
size
(required) - string used to indicate the dumpling size ('small' or 'large')icon
- object used for generating the Icon component within the dumpling withtype
andsize
key/value pairsimage
- object used for generating an<img>
tag withurl
andaltText
key/value pairsmotion
- boolean that indicates whether to use thereact-reveal
library to render the component inside a<Fade>
component.motionDirection
- string indicating the direction that the component should travel from as it fades in.motionDelay
- string in milliseconds indicating how long the delay should be before motion occursmotionDistance
- string indicating the distance that the component travels during motion
Examples -
<Dumpling
image={{ url: "./1-to-1.png", altText: "1-to-1 image" }}
size="small"
title="Dumplin'"
link={{ url: "#" }}
/>
<Dumpling
icon={{ type: "enclosed-check-dark-48px", size: "48px" }}
size="small"
title="Dumplin'"
link={{ url: "#" }}
/>
EventCard
Props -
header
(required) - string used for generating header textdate
(required) - string used for generating date textvenue
(required) - string used for generating venue textlocation
(required) - string used for generating location textctaOne
- object used for generating a cta requiringurl
andtext
stringsctaTwo
- object used for generating a cta requiringurl
andtext
stringsmotion
- boolean that indicates whether to use thereact-reveal
library to render the component inside a<Fade>
component.motionDirection
- string indicating the direction that the component should travel from as it fades in.motionDelay
- string in milliseconds indicating how long the delay should be before motion occursmotionDistance
- string indicating the distance that the component travels during motion
Example -
<EventCard
header='header'
date='01/01/01'
venue='building name'
location='city name'
ctaOne={{url: '/#', text: 'button one'}}
ctaTwo={{url: '/#', text: 'button two'}}
/>
Filter
Props -
title
(required) - string used to generate the title text for the filter bar when closed (i.e.: 'Filter by:', etc.)options
(required) - array of strings used for generating checkbox labels and checkbox names, the latter of which is passed up with the event object viatoggleCheckBox()
selections
(required) - array of strings used for indicating which of the checkboxes are selected. Cooresponds to theoptions
array stringstoggleCheckBox
(required) - function used toggling the individual filter check boxes on and off. Takes a single argument of the event object.
Example -
const filter = ['cats', 'dogs', 'bats', 'frogs']
<Filter
title='Filter by species'
options={filter}
toggleCheckBox={this.toggleAnimalFilter}
selection={this.state.animalSelections}
>
FilterAndSort
Props -
filterOne
(required) - an object consisting of atitle
string,selections
array strings, andoptions
array of strings for populating a<Filter>
componentfilterTwo
- an object consisting of atitle
string,selections
array strings, andoptions
array of strings for populating a<Filter>
componentsort
(required) - an object consisting of anoptions
array of strings, ahandleSelection
method, aselection
string, adefaultText
string, and aname
string for populating a<Select>
componenttoggleFilter
(required) - a function for adding and removing filters. Passes up either'filterOneSelections'
or'filterTwoSelections'
as well as the cooresponding checkbox label
Example -
const filterOne = {
title: 'animals',
selections: this.state.filterOneSelections,
options: ['dog', 'cat', 'fox']
}
const filterTwo = {
title: 'colors',
selections: this.state.filterTwoSelections,
options: ['red', 'yellow', 'blue']
}
const sort = {
options: ['alphabetical', 'length'],
handleSelection: this.selectSort,
selection: this.state.sortSelection,
defaultText: 'Sort by',
name: 'sortSelection'
}
<FilterAndSort
filterOne={filterOne}
filterTwo={filterTwo}
sort={sort}
toggleFilter={this.toggleFilter}
/>
Icon
Props -
type
- string indicating the type of icon renderedsize
- string indicating icon size
######type
options -
- open caret -
"open-caret-[UP/DOWN/RIGHT/LEFT]-[8/16/32]px"
Example -
<Icon type="open-caret-right-dark-8px" size="8px" />
IconListItem
Props -
header
(required) - a string for generating the component's header texttext
(required) - a string for generating the component's body textinsertHTML
- boolean that indicates whether thetext
prop should be inserted as innerHTML (true) or simply passed as a text string to a<p>
tag.motion
- boolean that indicates whether to use thereact-reveal
library to render the component inside a<Fade>
component.motionDirection
- string indicating the direction that the component should travel from as it fades in.motionDelay
- string in milliseconds indicating how long the delay should be before motion occursmotionDistance
- string indicating the distance that the component travels during motion
Example -
<IconListItem header='I am a header' text='Minim id sint ad sunt.' />
LinkCard -
Props -
header
(required) - string for generating header texttext
(required) - string for generating body textlink
(required) - object consisting ofurl
andtext
key/value pairs as strings for generating an<a>
tag
Example -
const link =
{
url: '/purchase',
text: 'Buy me now!'
}
<LinkCard
header='Link Card'
text='Minim irure excepteur officia sit mollit veniam amet sint velit ad do laboris.'
link={link}
/>
LinkTile
Props -
content
(required) - an object takingheader
,text
, andlink
key/value pairs.header
andtext
are strings.link
is an object consisting of aurl
string.motion
- boolean that indicates whether to use thereact-reveal
library to render the component inside a<Fade>
component.motionDirection
- string indicating the direction that the component should travel from as it fades in.motionDelay
- string in milliseconds indicating how long the delay should be before motion occursmotionDistance
- string indicating the distance that the component travels during motion
Example -
const content = {
header: 'Link Tile',
text: 'Do tempor occaecat culpa proident cillum velit eiusmod commodo elit occaecat elit.'
link: {
url: "http://www.yahoo.com",
}
}
<LinkTile content={content} />
LogoDumpling
Props -
image
(required) - object containingurl
andaltText
key/value strings for generating an<img>
elementtext
(required) - string used for generating the dumpling's textmotion
- boolean that indicates whether to use thereact-reveal
library to render the component inside a<Fade>
component.motionDirection
- string indicating the direction that the component should travel from as it fades in.motionDelay
- string in milliseconds indicating how long the delay should be before motion occursmotionDistance
- string indicating the distance that the component travels during motion
Example -
const image = {
url: './image.png',
altText: 'image description'
}
<LogoDumpling image={image} text='Company Name' />
LogoDumplingContainer
Props -
dumplings
(required) - array of objects consisting of theimage
andtext
attributes for a<LogoDumpling>
componentmotion
- boolean that indicates whether to use thereact-reveal
library to render the component inside a<Fade>
component.motionDirection
- string indicating the direction that the component should travel from as it fades in.motionDelay
- boolean indicating whether to stagger the effect of successive card fadesmotionDistance
- string indicating the distance that the component travels during motion
Example -
const dumplings = [
{
image: {
url: './image.png',
altText: 'description'
},
text: 'Company Name
},
{
image: {
url: './image.png',
altText: 'description'
},
text: 'Company Name
},
{
image: {
url: './image.png',
altText: 'description'
},
text: 'Company Name
}
]
<LogoDumplingContainer dumplings={dumplings} />
Modal
Props -
className
- string interpolated into the className of the component for styling options: use with caution.header
- string used for the modal's headername
- string used for the check box's name for parent state managementtext
- string used for the modal's textcloseModal
(required) - function used to no longer render the modal, takes an argument of the name passed down in propsbuttonOne
- object consisting orurl
,text
, andclassName
strings for populating a<ButtonLink>
componentbuttonTwo
- object consisting orurl
,text
, andclassName
strings for populating a<ButtonLink>
component
Example -
<Modal
className=''
header='Modal Title'
text='Hello. I am a modal'
closeModal={this.closeModal}
buttonOne={{onClick={this.buttonOneClick}, text='button one', className='ter-button-primary--1'}}
buttonTwo={{onClick={this.buttonTwoClick}, text='button two', className='ter-button-secondary--1'}
/>
MultipleSearchSelect
Props -
defaultText
(required) - string used to populate the search field before any selections are madeoptions
(required) - an array of strings used to generate options for selectionselection
(required) - an array of string used to provide the currently selected optionshandleSelect
(required) - function used to add an option to the selection array, takes two arguments of the selection and the component's nameremoveSelection
(required) - function used to remove an option from the selection array, takes two arguments of the selection and the component's namename
(required) - string used for labeling the array for parent component processing
Example -
<MultipleSearchSelect
defaultText='I am a multiple search select component'
options=['dog', 'cat', 'bird', 'turtle']
selection={this.state.multipleSearchSelectOne}
handleSelect={this.addMultiSearchSelectOption}
removeSelection={this.removeMultiSearchSelectOption}
name='multipleSearchSelectOne'
/>
Notification
Props -
text
(required) - string used for notification contenttype
(required) - string used for indicating notification typeonClick
(required) - function used for calling a method to close the notification and no longer render it, takes no arguments
Example -
<Notification
text='Hello. I am a notification'
type='default'
onClick={this.closeNotification}
/>
Pagination
Props -
pages
(required) - number indicating the total number of pages accessible via the componentactivePage
(required) - number indicating the index of the current page in the Pagination array - i.e. passing in0
would display the first pagehandleClick
(required) - function used to set the new index of the currently displayed item in the Pagination array, takes arguments of the new index and the component'sname
name
- string used for the check box's name for parent state management
Example -
<Pagination pages={4} activePage={0} handleClick={this.setPage} />
PricingCard
Props -
product
(required) - string used for generating the product nameversion
(required) - string used for generating the product version/subtitledescription
(required) - string used for generating product descriptioncost
(required) - string used for generating product costcurrency
(required) - string used for indicating currency typebuttonLink
(required) - object consisting of url and text strings to direct the user to the purchase page.motion
- boolean that indicates whether to use thereact-reveal
library to render the component inside a<Fade>
component.motionDirection
- string indicating the direction that the component should travel from as it fades in.motionDelay
- string in milliseconds indicating how long the delay should be before motion occursmotionDistance
- string indicating the distance that the component travels during motion
Example -
const link = {
url: '/purchase',
text; 'Purchase'
}
<PricingCard
product='SketchUp'
version='Pro'
description='Velit excepteur dolore sunt ea nostrud eu duis tempor aliquip consequat elit duis.'
cost='$119/yr'
currecny='USD'
buttonLink={link}
>
Radios
Props -
radios
(required)- an array of strings used to label each individual radio buttonselected
(required)- string used to indicate the currently selected radio button, generally same asname
selectRadio
(required)- function used to change the currently selected radio button in the parent component, takes two arguments of the new selected radio button and the component's namename
(required)- string used to name the radio component for processing in the parent component, should be unique
Example -
<Radios
radios={['radio one', 'radio two', 'radio three]}
selectRadio={this.selectRadio}
selected={this.state.selectedRadio}
name="selectedRadio"
/>
SearchBar
Props -
searchItems
- an array of strings used for generating predictive texthandleSubmit
(required) - function passed down for passing up the search string, takes two arguments of the field's search string and thename
propplaceholder
- string used for generating a custom string of placeholder text, defaults toSearch
predictiveSearch
- boolean used to tell the component whether or not to produce a list of predictive search itemsname
- string used to name the radio component for processing in the parent component, should be unique
Example -
<SearchBar searchItems={}
searchItems={['dogs', 'cats', 'frogs', 'birds']}
handleSubmit={this.setSearchString}
placeholder='I am custom placeholder text'
predictiveSearch={true}
/>
SearchSelect
Props -
defaultText
(required) - string used for generating the default text in the selected fieldoptions
(required) - array of strings to select fromselection
(required) - string indicating the currently-selected stringhandleSelect
(required) - function used for changing the currently selected string, takes two arguments of the newly selected item as a string and thename
propname
- string used to name the radio component for processing in the parent component, should be unique
Example -
<SearchSelect
defaultText='Select an animal'
options={'dog', 'cat', 'turtle'}
selection={this.state.selectedAnimal}
handleSelect={this.selectAnimal}
/>
Select
Props -
options
(required) - array of strings used for generating select optionshandleSelection
(required) - function used for changing the currently selection, takes two arguments of the new selection and the component'sname
propselection
(required) - string indicating the current selectdefaultText
(required) - string indicating the default text in the selected fieldname
(required) - string used for parent processing of the component
Example -
<Select
options={['red', 'blue', 'yellow']}
handleSelection={this.selectColor}
selection={this.state.color}
defaultText='Select a color'
name='color'
/>
Table
Props -
data
(required) - object containing the information to be rendered in the table withhead
andbody
keys. Each key is assigned to an array for each row.loose
- boolean that when set totrue
will add theter-table--loose
class to the component
Example -
const tableDataSource = {
head: ['column one', 'column two', 'column three],
body: [
['R1/C1', 'R1/C2', 'R1/C3],
['R2/C1', 'R2/C2', 'R2/C3],
['R3/C1', 'R3/C2', 'R3/C3]
]
}
<Table
data={tableDataSource}
loose={true}
/>
Tabs
Props -
TabsPanel
(required) - child element ofTabs
that generates the content within an individual tab. Takes a single prop ofname
as a string.theme
- string indicating the theme used for the tab organism. Current options are'default'
and'brand-regular'
Example -
<Tabs selected={0} fullWidth={false}>
<TabsPanel name="First">
<h3>First Tab</h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer
lobortis augue ligula, eget gravida tellus lacinia id. Sed ultricies
mi malesuada tincidunt dapibus. Donec porta ligula sagittis elit
sollicitudin.
</p>
</TabsPanel>
<TabsPanel name="Second">
<h3>Second Tab</h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer
lobortis augue ligula, eget gravida tellus lacinia id. Sed ultricies
mi malesuada tincidunt dapibus. Donec porta ligula sagittis elit
sollicitudin.
</p>
</TabsPanel>
<TabsPanel name="Third">
<h3>Third Tab</h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer
lobortis augue ligula, eget gravida tellus lacinia id. Sed ultricies
mi malesuada tincidunt dapibus. Donec porta ligula sagittis elit
sollicitudin.
</p>
</TabsPanel>
</Tabs>
TextArea
Props -
label
- string used for the label element of the inputinputChange
(required) - function that determines what happens when the input value has changed, takes two arguments of the event object and the component'sname
propvalue
(required) - string for the value of the inputname
- string used for parent processing of the component
Example -
<TextArea
label="Form Item Label"
placeholder="test placeholder text"
value={this.state.textArea}
/>
TextInput
Props -
label
- string used for the label element of the inputplaceholder
- optional string used to determine the placeholder text for an inputinputChange
(required) - function that determines what happens when the input value has changed, takes a single argument of the event objectvalue
(required) - string for the value of the inputstatus
- object that is passed into the component to provied anerror
orsuccess
state, accompanied by amessage
. Both the className and message are required in the object. Example below:{ className: "error", message: "error!" }
name
(required) - string used as the field name, returned in the event object
Example -
<TextInput
label="Form Item Label"
placeholder="test placeholder text"
name="test"
status=""
value={this.state.test}
/>