Porunga - Another React UI Library
Porunga is an another ReactJS UI library!
We hope to deliver an easy to use component API that can be easily extendable to fit the functional and design needs for multiple platforms and audiences.
Porunga is an another ReactJS UI library!
We hope to deliver an easy to use component API that can be easily extendable to fit the functional and design needs for multiple platforms and audiences.
To ensure transpareny across the library and a consistent API, the following is a set of guidelines to follow in terms of approaching the design of the API.
Using the children property is the idiomatic way to do composition with React.
Using props.children
is a great way to provide composition with our genereic components, however, there will be some cases where a component may benefit in only expecting explicit properties.
For the most part, API consistency matters.
For now, lets try and keep the use of spread operators sparingly for props on a component.
Boolean props can benefit from it's shorthand usage; you can specify them without a value.
type Props = { large: boolean; } <Button large>SIGN UP NOW!</Button> //is the same as... <Button large={true}>SIGN UP NOW!</Button>
If they are included, it's true. If they aren't, it's false (unless stated otherwise in your default values).
The main issue is when you use these boolean props for size, variants, colours that need more than a on or off.
type Props = { large: boolean small: boolean primary: boolean secondary: boolean disabled: boolean }
<Button large small primary secondary disabled> WUT? </Button>
Instead of adding multiple props trying to fight for handling similar things we can make use of enums when needed.
type Props = { size: 'small' | 'medium' | 'large' variant: 'primary' | 'secondary' disabled: boolean }
<Button variant="primary" size="large" disabled> Primary Large Disabled Button here </Button>
The extra benefits include a more verbose API that can also handle more values when neeeded, while keeping boolean props for values that only require to be on or off.
Whenever a prop is not required in a component, a sufficient defualt should be provided to minimize the amount of props needed to pass for a component to be used.
An example could be if an optional prop is a string type value, give a default value of an empty string. This will prevent having to deal with undefined or null values.
HTML attributes already exist. Developers shouldn't have to learn a superset of HTML attributes to use the library.
If we want to give access to aria-label
, we should give them access to that attribute through it's existing name unlike creating our own language like screenReaderLabel
.
Keep in mind when defining props for the components to not override an existing attribute name.
type Props = { type: string }
<Button type="primary">SIGN UP NOW!</Button>
type
here is a prop defined to handle a potentially arbiturary rule in the library, meanwhile type
is already an HTML attribute that the <button />
element takes that can be submit
,button
,reset
that does it's own stuff.
Ultimately, this would end up causing confusion and unexpected behaviour.
On the counter-part to renaming HTML attributes, if a component is given explicit control over a css property styling like backgroundColor
through a prop, the prop should also be named backgroundColor
instead of something like bgColor
.
The latter may be shorter, but it creates a mapping of terminology that isn't quite 1:1.
The first option should keep the API more predictable with explicit styling.
With the library using TypeScrpt, you many have a hard time trying to not use types, but it's important to note types are important.
JSDoc standard comments are also beneficial not only for providing a standard for commenting, but the package styleguidist
uses these types and JSDoc comments to generate documenttion for our components in it's styleguide.
Let's make a dope component library!
The theme is responsible for containing global style key values like a colour pallete, and component specific style options like the font sizes of a Heading or Paragraph.
With a theme in place, every component has a common language in how it retrieves it's type and magnitude of styling, aswell as giving the developer a common language when using the available props for each component.
{ "root": { "colors": { "brand": "#E8325A", "accent-1": "#216CA9", "accent-2": "#916364", "accent-3": "#6EB785", "accent-4": "#745AAA", "neutral-1": "#0a4c83", "neutral-2": "#5b3132", "neutral-3": "#21703a", "neutral-4": "#2e1465", "error": "#FF4040", "warning": "#FFAA15", "success": "#00C781", "unknown": "#CCCCCC", "disabled": "#CCCCCC", "light-1": "#F8F8F8", "light-2": "#F2F2F2", "light-3": "#EDEDED", "light-4": "#DADADA", "light-5": "#DADADA", "light-6": "#DADADA", "dark-1": "#333333", "dark-2": "#555555", "dark-3": "#777777", "dark-4": "#999999", "dark-5": "#999999", "dark-6": "#999999", "transparent": "transparent" }, "spacing": { "xxsmall": "3px", "xsmall": "5px", "small": "10px", "medium": "20px", "large": "40px", "xlarge": "60px", "xxlarge": "80px", "auto": "auto", "unset": "" }, "borderSizes": { "xxsmall": "1px", "xsmall": "2px", "small": "3px", "medium": "5px", "large": "10px", "xlarge": "20px", "xxlarge": "40px", "unset": "" }, "sizes": { "xxsmall": "40px", "xsmall": "80px", "small": "160px", "medium": "320px", "large": "640px", "xlarge": "960px", "xxlarge": "1280px", "1/2": "50%", "1/3": "33.33%", "2/3": "66.66%", "1/4": "25%", "2/4": "50%", "3/4": "75%", "full": "100%", "auto": "auto", "unset": "" }, "shadows": { "xsmall": "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06)", "small": "0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)", "medium": "0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)", "large": "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04)", "xlarge": "0 25px 50px -12px rgba(0, 0, 0, 0.25)", "unset": "" }, "isAllRounded": false }, "paragraph": { "sizes": { "xxsmall": "11px", "xsmall": "12px", "small": "14px", "medium": "16px", "large": "18px", "xlarge": "20px", "xxlarge": "24px" } }, "text": { "sizes": { "xxsmall": "xx-small", "xsmall": "x-small", "small": "small", "medium": "medium", "large": "large", "xlarge": "x-large", "xxlarge": "xx-large" }, "weights": { "normal": "normal", "bold": "bold", "bolder": "bolder", "lighter": "lighter", 100: "100", 200: "200", 300: "300", 400: "400", 500: "500", 600: "600", 700: "700", 800: "800", "unset": "" }, "styles": { "normal": "normal", "italic": "italic", "oblique": "oblique", "inherit": "inherit", "initial": "initial", "unset": "unset" } }, "heading": { "sizes": { "xxsmall": "3px", "xsmall": "5px", "small": "10px", "medium": "20px", "large": "40px", "xlarge": "60px", "xxlarge": "80px", "unset": "" } }, "box": { "rounded": "24px" }, "button": { "rounded": "24px" }, "badge": { "rounded": "24px" }, "checkbox": { "rounded": "12px" }, "progressBar": { "rounded": "24px" }, "input": { "rounded": "24px" } }
Currently using Porunga, the provided theme wrapper component must be wrapped around the root of a react app for it's styles to function as intended. A default theme is applied when no theme
prop value is assigned.
When passing a theme object into the provided wrapper, the given theme object will merge with the default theme so that you only need to change exactly what you want.
Prop name | Type | Default | Description |
---|---|---|---|
alt | string | ||
bgColor | enum | One of: brand , accent-1 , accent-2 , accent-3 , accent-4 , neutral-1 , neutral-2 , neutral-3 , neutral-4 , error , warning , success , unknown , disabled , light-1 , light-2 , light-3 , light-4 , light-5 , light-6 , dark-1 , dark-2 , dark-3 , dark-4 , dark-5 , dark-6 , transparent | |
containerProps | any | ||
imgSrc | string | ||
onClick | any | ||
props | any | ||
round | boolean | ||
size | enum | One of: xxsmall , xsmall , small , medium , large , xlarge , xxlarge , 1/2 , 1/3 , 2/3 , 1/4 , 2/4 , 3/4 , full , auto , unset | |
text | string | ||
textColor | enum | One of: brand , accent-1 , accent-2 , accent-3 , accent-4 , neutral-1 , neutral-2 , neutral-3 , neutral-4 , error , warning , success , unknown , disabled , light-1 , light-2 , light-3 , light-4 , light-5 , light-6 , dark-1 , dark-2 , dark-3 , dark-4 , dark-5 , dark-6 , transparent |
Prop name | Type | Default | Description |
---|---|---|---|
icon | any | An optional icon to display | |
rounded | Rounded | How round the corners are of the box | |
text | string | The text to display in the badge | |
variant | enum | The background color of the badge One of: brand , accent-1 , accent-2 , accent-3 , accent-4 , neutral-1 , neutral-2 , neutral-3 , neutral-4 , error , warning , success , unknown , disabled , light-1 , light-2 , light-3 , light-4 , light-5 , light-6 , dark-1 , dark-2 , dark-3 , dark-4 , dark-5 , dark-6 , transparent |
Badges
<Badge text="Nice" /> <Badge text="Nice" variant="accent-1" /> <Badge text="Nice" variant="accent-2"/> <Badge text="Nice" variant="accent-3"/> <Badge text="Nice" variant="accent-4"/> <Badge text="Nice" variant="success" /> <Badge text="Nice" variant="warning" />
<Badge rounded text="Nice Round" /> <Badge rounded text="Nice Round" variant="accent-1" /> <Badge rounded text="Nice Round" variant="accent-2" /> <Badge rounded text="Nice Round" variant="accent-3" /> <Badge rounded text="Nice Round" variant="accent-4" /> <Badge rounded text="Nice Round" variant="success" /> <Badge rounded text="Nice Round" variant="warning" />
Prop name | Type | Default | Description |
---|---|---|---|
alignContent | enum | How to align the contents when there is extra space in the cross axis. One of: flex-start , center , flex-end , space-around , space-between , stretch | |
alignItems | enum | How to align the contents along the cross axis. One of: flex-start , center , flex-end , stretch , baseline | |
alignSelf | enum | How to align along the cross axis when contained in a Box or along the column axis when contained in a Grid. One of: flex-start , center , flex-end , stretch , baseline | |
as | string | Function | The DOM tag or react component to use for the element. | |
backgroundColor | enum | A backgroundColor identifier One of: brand , accent-1 , accent-2 , accent-3 , accent-4 , neutral-1 , neutral-2 , neutral-3 , neutral-4 , error , warning , success , unknown , disabled , light-1 , light-2 , light-3 , light-4 , light-5 , light-6 , dark-1 , dark-2 , dark-3 , dark-4 , dark-5 , dark-6 , transparent | |
basis | enum | A fixed or relative size along its container's main axis. One of: xxsmall , xsmall , small , medium , large , xlarge , xxlarge , 1/2 , 1/3 , 2/3 , 1/4 , 2/4 , 3/4 , full , auto , unset | |
borderColor | enum | A borderColor identifier One of: brand , accent-1 , accent-2 , accent-3 , accent-4 , neutral-1 , neutral-2 , neutral-3 , neutral-4 , error , warning , success , unknown , disabled , light-1 , light-2 , light-3 , light-4 , light-5 , light-6 , dark-1 , dark-2 , dark-3 , dark-4 , dark-5 , dark-6 , transparent | |
borderStyle | enum | A borderStyle identifier One of: none , solid , dashed , dotted , double , groove , ridge , inset , outset , hidden | |
borderWidth | enum | A size identifier One of: xxsmall , xsmall , small , medium , large , xlarge , xxlarge , 1/2 , 1/3 , 2/3 , 1/4 , 2/4 , 3/4 , full , auto , unset | |
children | any | Content inside the Box element | |
direction | enum | Specifies the direction of the child items One of: row , row-reverse , column , column-reverse | |
grow | number | How much of the remaining space in the flex container should be assigned to the box | |
height | enum | The fixed height One of: xxsmall , xsmall , small , medium , large , xlarge , xxlarge , 1/2 , 1/3 , 2/3 , 1/4 , 2/4 , 3/4 , full , auto , unset | |
justifyContent | enum | How to align the contents along the main axis. One of: flex-start , center , flex-end , space-around , space-between , stretch , space-evenly | |
margin | "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge" | "1/2" | "1/3" | "2/3" | "1/4" | "2/4" | "3/4" | "full" | "auto" | "unset" | DirectionsSizes | The amount of margin around the box contents. DirectionSizes: {t: enum, r: enum, l: enum, b: enum} | |
padding | "xxsmall" | "xsmall" | "small" | "medium" | "large" | "xlarge" | "xxlarge" | "1/2" | "1/3" | "2/3" | "1/4" | "2/4" | "3/4" | "full" | "auto" | "unset" | DirectionsSizes | The amount of padding around the box contents. DirectionSizes: {t: enum, r: enum, l: enum, b: enum} | |
props | any | Any extra properties to pass to the Box | |
rounded | Rounded | How round the corners are of the box | |
shadow | enum | The amount of box shadow applied to box One of: xxsmall , xsmall , small , medium , large , xlarge , xxlarge , 1/2 , 1/3 , 2/3 , 1/4 , 2/4 , 3/4 , full , auto , unset | |
shrink | number | If the size of all flex items is larger than the flex container, items shrink to fit accordingly | |
width | enum | The fixed width One of: xxsmall , xsmall , small , medium , large , xlarge , xxlarge , 1/2 , 1/3 , 2/3 , 1/4 , 2/4 , 3/4 , full , auto , unset | |
wrap | enum | Specifies if child elements should fall to a new row if they don't fit One of: wrap , wrap-reverse , no-wrap |
Default Box
<Box padding="medium" borderStyle="solid" borderColor="brand" borderWidth="small" justify="space-between" > <Box margin="small" padding="large" backgroundColor="light-5"> box </Box> <Box margin="small" padding="large" backgroundColor="light-5"> box </Box> <Box margin="small" padding="large" backgroundColor="light-5"> box </Box> </Box>
Column direction Box
<Box padding="medium" borderStyle="solid" borderColor="brand" borderWidth="small" direction="column" > <Box padding="large" margin="small" backgroundColor="light-5"> box </Box> <Box padding="large" margin="small" backgroundColor="light-5"> box </Box> <Box padding="large" margin="small" backgroundColor="light-5"> box </Box> </Box>
Wrap Box
<Box padding="medium" borderStyle="solid" borderColor="brand" borderWidth="small" wrap="wrap" > <Box padding="xxlarge" margin="small" backgroundColor="light-5"> box </Box> <Box padding="xxlarge" margin="small" backgroundColor="light-5"> box </Box> <Box padding="xxlarge" margin="small" backgroundColor="light-5"> box </Box> <Box padding="xxlarge" margin="small" backgroundColor="light-5"> box </Box> <Box padding="xxlarge" margin="small" backgroundColor="light-5"> box </Box> <Box padding="xxlarge" margin="small" backgroundColor="light-5"> box </Box> <Box padding="xxlarge" margin="small" backgroundColor="light-5"> box </Box> </Box>
Button
Prop name | Type | Default | Description |
---|---|---|---|
label | string | Required | |
className | string | ||
disabled | boolean | ||
isOutline | boolean | ||
onClick | () => any | Content inside the button element | |
primaryColor | enum | One of: disabled , brand , accent-1 , accent-2 , accent-3 , accent-4 , neutral-1 , neutral-2 , neutral-3 , neutral-4 , error , warning , success , unknown , light-1 , light-2 , light-3 , light-4 , light-5 , light-6 , dark-1 , dark-2 , dark-3 , dark-4 , dark-5 , dark-6 , transparent | |
rounded | Rounded | ||
secondaryColor | enum | One of: disabled , brand , accent-1 , accent-2 , accent-3 , accent-4 , neutral-1 , neutral-2 , neutral-3 , neutral-4 , error , warning , success , unknown , light-1 , light-2 , light-3 , light-4 , light-5 , light-6 , dark-1 , dark-2 , dark-3 , dark-4 , dark-5 , dark-6 , transparent |
Default Button
<Button primaryColor='brand' label="Brand" /> <Button primaryColor='accent-1' label="Accent-1" /> <Button primaryColor='success' label="Success" /> <Button primaryColor='warning' label="Warning" /> <Button primaryColor='error' label="Error" />
<Button rounded primaryColor='brand' label="Brand" /> <Button rounded primaryColor='accent-1' label="Accent-1" /> <Button rounded primaryColor='success' label="Success" /> <Button rounded primaryColor='warning' label="Warning" /> <Button rounded primaryColor='error' label="Error" />
<Button isOutline primaryColor='brand' label="Brand" /> <Button isOutline primaryColor='accent-1' label="Accent-1" /> <Button isOutline primaryColor='success' label="Success" /> <Button isOutline primaryColor='warning' label="Warning" /> <Button isOutline primaryColor='error' label="Error" />
<Button rounded isOutline primaryColor='brand' label="Brand" /> <Button rounded isOutline primaryColor='accent-1' label="Accent-1" /> <Button rounded isOutline primaryColor='success' label="Success" /> <Button rounded isOutline primaryColor='warning' label="Warning" /> <Button rounded isOutline primaryColor='error' label="Error" />
Prop name | Type | Default | Description |
---|---|---|---|
children | any | Content inside Card's content section | |
footerText | string | Small muted text under card content | |
heroImage | { position: "left" | "right" | "top"; alt: string; src: string; srcSet?: string; sizes?: string; } | An object of image data that will render on top of the card | |
rounded | boolean | Whether or not to round the corners to the theme's specifcations | |
title | string | The main title in the card content area | |
titleAlign | enum | Horizontal alignment of title One of: left , center , right , justify |
<Card title="Nostrud incididunt minim occaecat aliqua nostrud eu nulla magna." footerText="Commodo nostrud sit veniam mollit esse sunt." > Consequat enim eiusmod qui cupidatat. Do enim incididunt aute pariatur enim nulla sunt ea minim. Dolore mollit dolore ex veniam anim. Consectetur labore dolore minim duis magna deserunt pariatur irure consequat. Laborum eiusmod ipsum et velit quis laborum labore laboris eu deserunt dolor dolore elit. </Card>
Card with Hero Image
<Card title="Nostrud incididunt minim occaecat aliqua nostrud eu nulla magna." heroImage={{ src: './porunga-close.png', alt: 'building-blocks' }} footerText="Commodo nostrud sit veniam mollit esse sunt." > Consequat enim eiusmod qui cupidatat. Do enim incididunt aute pariatur enim nulla sunt ea minim. Dolore mollit dolore ex veniam anim. Consectetur labore dolore minim duis magna deserunt pariatur irure consequat. Laborum eiusmod ipsum et velit quis laborum labore laboris eu deserunt dolor dolore elit. </Card>
<Card title="Nostrud incididunt minim occaecat aliqua nostrud eu nulla magna." heroImage={{ src: './porunga-close.png', alt: 'building-blocks', position: 'right', }} footerText="Commodo nostrud sit veniam mollit esse sunt." > Consequat enim eiusmod qui cupidatat. Do enim incididunt aute pariatur enim nulla sunt ea minim. Dolore mollit dolore ex veniam anim. Consectetur labore dolore minim duis magna deserunt pariatur irure consequat. Laborum eiusmod ipsum et velit quis laborum labore laboris eu deserunt dolor dolore elit. </Card>
Checkbox
Prop name | Type | Default | Description |
---|---|---|---|
label | string | Required | |
checked | boolean | ||
className | string | ||
disabled | boolean | ||
id | string | ||
name | string | ||
onChange | (isChecked: boolean) => any | Content inside the checkbox element | |
primaryColor | enum | One of: disabled , brand , accent-1 , accent-2 , accent-3 , accent-4 , neutral-1 , neutral-2 , neutral-3 , neutral-4 , error , warning , success , unknown , light-1 , light-2 , light-3 , light-4 , light-5 , light-6 , dark-1 , dark-2 , dark-3 , dark-4 , dark-5 , dark-6 , transparent | |
rounded | Rounded |
Default Checkbox
<Checkbox primaryColor='brand' label="Brand Checkbox" /> <Checkbox primaryColor='accent-1' label="Accent-1 Checkbox" /> <Checkbox primaryColor='success' label="Success Checkbox" /> <Checkbox primaryColor='warning' label="Warning Checkbox" /> <Checkbox primaryColor='error' label="Error Checkbox" />
<Checkbox rounded primaryColor='brand' label="Brand Round Checkbox" /> <Checkbox rounded primaryColor='accent-1' label="Accent-1 Round Checkbox" /> <Checkbox rounded primaryColor='success' label="Success Round Checkbox" /> <Checkbox rounded primaryColor='warning' label="Warning Round Checkbox" /> <Checkbox rounded primaryColor='error' label="Error Round Checkbox" />
Heading
Prop name | Type | Default | Description |
---|---|---|---|
children | any | Required | Content inside the Heading element |
ariaLabel | string | aria-label will be added to the element and used by screen readers | |
className | string | Class attribute for Heading element | |
color | enum | The color of text using an identifier One of: brand , accent-1 , accent-2 , accent-3 , accent-4 , neutral-1 , neutral-2 , neutral-3 , neutral-4 , error , warning , success , unknown , disabled , light-1 , light-2 , light-3 , light-4 , light-5 , light-6 , dark-1 , dark-2 , dark-3 , dark-4 , dark-5 , dark-6 , transparent | |
level | enum | Heading Level One of: h1 , h2 , h3 , h4 , h5 , h6 | |
size | enum | Font size of Heading using an identitfier One of: xxsmall , xsmall , small , medium , large , xlarge , xxlarge , 1/2 , 1/3 , 2/3 , 1/4 , 2/4 , 3/4 , full , auto , unset | |
textAlign | enum | Alignment of text inside One of: left , center , right , justify |
<Heading>Heading 1</Heading> <Heading level="h2">Heading 2</Heading> <Heading level="h3">Heading 3</Heading> <Heading level="h4">Heading 4</Heading> <Heading level="h5">Heading 5</Heading> <Heading level="h6">Heading 6</Heading>
Prop name | Type | Default | Description |
---|---|---|---|
borderColorActive | string | The border color for the input when active | |
borderColorInactive | string | The border color for the input when inactive | |
bottomText | string | Helper text to show below the input | |
bottomTextProps | any | Any extra properties to pass to the bottom text | |
containerProps | any | Any extra properties to pass to the container | |
disabled | boolean | Whether or not the input is disabled | |
hideLabel | boolean | Whether or not to hide the label | |
id | string | The id for the input (can't enforce they send this, so generate a random one by default) | |
label | string | The text label for the input | |
labelProps | any | Any extra properties to pass to the label | |
maxLength | string | The maximum length of the input field | |
minLength | string | The minimum length of the input field | |
name | string | The name of the input | |
onBlur | () => {} | A callback function for the on blur event | |
onChange | () => {} | A callback function for the on change event | |
onClick | () => {} | A callback function for the on click event | |
onFocus | () => {} | A callback function for the on focus event | |
onKeyDown | () => {} | A callback function for the on click event | |
pattern | string | A regex pattern to check | |
placeholder | string | The input placeholder text | |
props | any | Any extra properties to pass to the input | |
readOnly | boolean | Whether or not the input is read only | |
required | boolean | Whether or not the input is required | |
rounded | Rounded | Optionally round the edges | |
tabIndex | string | The tab index for the input | |
title | string | The input title (the tooltip that comes up when validation fails) | |
type | enum | The type of the input One of: number , text , password , datetime , datetime-local , date , month , time , week , email , url , search , tel , color | |
value | string | The value of the input |
Default Input
Input (Placeholder)
Input (Disabled)
Input (Required)
Input (Bottom Text)
Input (Border Color)
Input (Alternate Types)
<Input label="Datetime" type="datetime-local" /> <Input label="Week" type="week" /> <Input label="Month" type="month" /> <Input label="Time" type="time" /> <Input label="Password" type="password" value="I'm hidden" />
Input (Pattern Matching)
Paragraph
Prop name | Type | Default | Description |
---|---|---|---|
children | any | Required | Content inside Paragraph component |
className | string | Class attribute for paragraph | |
color | enum | Color of text One of: brand , accent-1 , accent-2 , accent-3 , accent-4 , neutral-1 , neutral-2 , neutral-3 , neutral-4 , error , warning , success , unknown , disabled , light-1 , light-2 , light-3 , light-4 , light-5 , light-6 , dark-1 , dark-2 , dark-3 , dark-4 , dark-5 , dark-6 , transparent | |
size | enum | Font size of text One of: xxsmall , xsmall , small , medium , large , xlarge , xxlarge , 1/2 , 1/3 , 2/3 , 1/4 , 2/4 , 3/4 , full , auto , unset | |
textAlign | enum | Alignment of text inside paragraph One of: left , center , right |
Id labore commodo velit ut adipisicing tempor amet. Incididunt sunt aute quis consequat adipisicing dolore culpa irure aliquip aliquip labore. Nisi fugiat proident cupidatat officia.
Id labore commodo velit ut adipisicing tempor amet. Incididunt sunt aute quis consequat adipisicing dolore culpa irure aliquip aliquip labore. Nisi fugiat proident cupidatat officia.
Id labore commodo velit ut adipisicing tempor amet. Incididunt sunt aute quis consequat adipisicing dolore culpa irure aliquip aliquip labore. Nisi fugiat proident cupidatat officia.
Id labore commodo velit ut adipisicing tempor amet. Incididunt sunt aute quis consequat adipisicing dolore culpa irure aliquip aliquip labore. Nisi fugiat proident cupidatat officia.
<Paragraph size="xxlarge"> Id labore commodo velit ut adipisicing tempor amet. Incididunt sunt aute quis consequat adipisicing dolore culpa irure aliquip aliquip labore. Nisi fugiat proident cupidatat officia. </Paragraph> <Paragraph size="large" color="dark-2"> Id labore commodo velit ut adipisicing tempor amet. Incididunt sunt aute quis consequat adipisicing dolore culpa irure aliquip aliquip labore. Nisi fugiat proident cupidatat officia. </Paragraph> <Paragraph size="medium" color="dark-3"> Id labore commodo velit ut adipisicing tempor amet. Incididunt sunt aute quis consequat adipisicing dolore culpa irure aliquip aliquip labore. Nisi fugiat proident cupidatat officia. </Paragraph> <Paragraph size="small" color="dark-4"> Id labore commodo velit ut adipisicing tempor amet. Incididunt sunt aute quis consequat adipisicing dolore culpa irure aliquip aliquip labore. Nisi fugiat proident cupidatat officia. </Paragraph>
The ProgressBar component allows the user to create a flexible progress bar for use in everything from loading states to step counters. You can choose to show the current percent, a custom value, or add an optional rounding for the borders of the progress bar.
Prop name | Type | Default | Description |
---|---|---|---|
className | string | Optional class name | |
color | enum | The color of the progress bar One of: brand , accent-1 , accent-2 , accent-3 , accent-4 , neutral-1 , neutral-2 , neutral-3 , neutral-4 , error , warning , success , unknown , disabled , light-1 , light-2 , light-3 , light-4 , light-5 , light-6 , dark-1 , dark-2 , dark-3 , dark-4 , dark-5 , dark-6 , transparent | |
customText | string | Text to display if custom | |
rounded | Rounded | Optionally round the progress bar | |
showValue | boolean | Whether to add text in the progress bar | |
textColor | string | Sets text color | |
value | number | The value of the progress bar (as percentage) |
Default Progress Bar
Progress Bar Pallete
<ProgressBar value={20} /> <ProgressBar color="accent-1" value={40} /> <ProgressBar color="success" value={60} /> <ProgressBar color="warning" value={80} /> <ProgressBar color="error" value={100} />
Progress Bar Rounded
<ProgressBar value={20} rounded /> <ProgressBar color="accent-1" value={40} rounded /> <ProgressBar color="success" value={60} rounded /> <ProgressBar color="warning" value={80} rounded /> <ProgressBar color="error" value={100} rounded />
Progress Bar With Percentage Text
<ProgressBar value={20} showValue /> <ProgressBar color="accent-1" value={40} showValue /> <ProgressBar color="success" value={60} showValue /> <ProgressBar color="warning" value={80} showValue /> <ProgressBar color="error" value={100} showValue />
Progress Bar With Custom Text
RadioButton
Prop name | Type | Default | Description |
---|---|---|---|
name | string | Required | A name identifier |
value | string | Required | A value identifier |
ariaDescribedBy | string | aria-label will be added to the element and used by screen readers | |
backgroundColor | enum | A backgroundColor identifier One of: brand , accent-1 , accent-2 , accent-3 , accent-4 , neutral-1 , neutral-2 , neutral-3 , neutral-4 , error , warning , success , unknown , disabled , light-1 , light-2 , light-3 , light-4 , light-5 , light-6 , dark-1 , dark-2 , dark-3 , dark-4 , dark-5 , dark-6 , transparent | |
checked | boolean | A checked identifier | |
children | any | Content inside the RadioButton element | |
className | string | Class attribute | |
color | enum | The color of text using an identifier One of: brand , accent-1 , accent-2 , accent-3 , accent-4 , neutral-1 , neutral-2 , neutral-3 , neutral-4 , error , warning , success , unknown , disabled , light-1 , light-2 , light-3 , light-4 , light-5 , light-6 , dark-1 , dark-2 , dark-3 , dark-4 , dark-5 , dark-6 , transparent | |
disabled | boolean | A disabled identifier | |
label | string | A label identifier | |
onClick | (event: SyntheticEvent<Element, Event>) => void | Event handler for onClick action |
Default RadioButton
<RadioButton backgroundColor="error" name="radio" value="one" label="One" onClick={(e) => alert(`Radio "${e.currentTarget.value}" Selected`) } /> <RadioButton backgroundColor="warning" name="radio" value="two" label="Two" onClick={(e) => alert(`Radio "${e.currentTarget.value}" Selected`) } /> <RadioButton backgroundColor="success" name="radio" value="three" label="Three" onClick={(e) => alert(`Radio "${e.currentTarget.value}" Selected`) } />
Prop name | Type | Default | Description |
---|---|---|---|
options | Option[] | Required | option elements inside Select {label: string, value: string, selected?: boolean, disabled?: boolean} |
defaultLabel | string | The default label selected | |
onChange | (change: { option: { value: string | number; label: string; }; }) => any | The interface for capturing values of selected option during the select onChange event | |
primaryColor | enum | The primary color to use from the theme palette One of: brand , accent-1 , accent-2 , accent-3 , accent-4 , neutral-1 , neutral-2 , neutral-3 , neutral-4 , error , warning , success , unknown , disabled , light-1 , light-2 , light-3 , light-4 , light-5 , light-6 , dark-1 , dark-2 , dark-3 , dark-4 , dark-5 , dark-6 , transparent | |
rounded | Rounded | Whether to round the edges based off of the theme config | |
secondaryColor | enum | The secondary color to use from the theme palette One of: brand , accent-1 , accent-2 , accent-3 , accent-4 , neutral-1 , neutral-2 , neutral-3 , neutral-4 , error , warning , success , unknown , disabled , light-1 , light-2 , light-3 , light-4 , light-5 , light-6 , dark-1 , dark-2 , dark-3 , dark-4 , dark-5 , dark-6 , transparent | |
shadow | enum | The amount of box shadow applied to box One of: xxsmall , xsmall , small , medium , large , xlarge , xxlarge , 1/2 , 1/3 , 2/3 , 1/4 , 2/4 , 3/4 , full , auto , unset |
Default Select
<Select options={[ { value: 'option-1', label: 'Option 1' }, { value: 'option-2', label: 'Option 2' }, ]} />
Default Select
<Select defaultLabel="Kept you waiting huh?" options={[ { value: 'option-1', label: 'Option 1' }, { value: 'option-2', label: 'Option 2' }, ]} />
Select Palette
<Select primaryColor="brand" options={[ { value: 'option-1', label: 'Option 1' }, { value: 'option-2', label: 'Option 2' }, ]} /> <Select primaryColor="accent-1" options={[ { value: 'option-1', label: 'Option 1' }, { value: 'option-2', label: 'Option 2' }, ]} /> <Select primaryColor="success" options={[ { value: 'option-1', label: 'Option 1' }, { value: 'option-2', label: 'Option 2' }, ]} /> <Select primaryColor="warning" options={[ { value: 'option-1', label: 'Option 1' }, { value: 'option-2', label: 'Option 2' }, ]} /> <Select primaryColor="error" options={[ { value: 'option-1', label: 'Option 1' }, { value: 'option-2', label: 'Option 2' }, ]} />
Select Palette Rounded
<Select rounded primaryColor="brand" options={[ { value: 'option-1', label: 'Option 1' }, { value: 'option-2', label: 'Option 2' }, ]} /> <Select rounded primaryColor="accent-1" options={[ { value: 'option-1', label: 'Option 1' }, { value: 'option-2', label: 'Option 2' }, ]} /> <Select rounded primaryColor="success" options={[ { value: 'option-1', label: 'Option 1' }, { value: 'option-2', label: 'Option 2' }, ]} /> <Select rounded primaryColor="warning" options={[ { value: 'option-1', label: 'Option 1' }, { value: 'option-2', label: 'Option 2' }, ]} /> <Select rounded primaryColor="error" options={[ { value: 'option-1', label: 'Option 1' }, { value: 'option-2', label: 'Option 2' }, ]} />
Prop name | Type | Default | Description |
---|---|---|---|
animate | boolean | If true, Skeleton background will animate | |
children | any | Content inside the Skeleton element | |
props | any | Any additional props for Skeleton |
import { Box } from 'components' ;<Box wrap="wrap" justifyContent="space-around" basis="small"> <Box width="small" direction="column"> <Skeleton height="xsmall" /> <Skeleton animate style={{ height: '1rem' }} margin={{ t: 'xsmall' }} /> <Skeleton animate style={{ height: '1rem' }} margin={{ t: 'xsmall' }} width="1/3" /> </Box> <Box width="small" direction="column"> <Skeleton height="xsmall" /> <Skeleton animate style={{ height: '1rem' }} margin={{ t: 'xsmall' }} /> <Skeleton animate style={{ height: '1rem' }} margin={{ t: 'xsmall' }} width="1/3" /> </Box> <Box width="small" direction="column"> <Skeleton height="xsmall" /> <Skeleton animate style={{ height: '1rem' }} margin={{ t: 'xsmall' }} /> <Skeleton animate style={{ height: '1rem' }} margin={{ t: 'xsmall' }} width="1/3" /> </Box> </Box>
Prop name | Type | Default | Description |
---|---|---|---|
primaryColor | enum | The primary color to use from the theme palette One of: brand , accent-1 , accent-2 , accent-3 , accent-4 , neutral-1 , neutral-2 , neutral-3 , neutral-4 , error , warning , success , unknown , disabled , light-1 , light-2 , light-3 , light-4 , light-5 , light-6 , dark-1 , dark-2 , dark-3 , dark-4 , dark-5 , dark-6 , transparent | |
size | enum | The size of the spinner. Defaults to small One of: xxsmall , xsmall , small , medium , large , xlarge , xxlarge , 1/2 , 1/3 , 2/3 , 1/4 , 2/4 , 3/4 , full , auto , unset | |
type | "solid" | Type of spinner to use. Defaults to solid |
Text
Prop name | Type | Default | Description |
---|---|---|---|
children | any | Required | Content inside Text component |
className | string | Class attribute for text | |
color | enum | Color of text One of: brand , accent-1 , accent-2 , accent-3 , accent-4 , neutral-1 , neutral-2 , neutral-3 , neutral-4 , error , warning , success , unknown , disabled , light-1 , light-2 , light-3 , light-4 , light-5 , light-6 , dark-1 , dark-2 , dark-3 , dark-4 , dark-5 , dark-6 , transparent | |
family | string | Font family of text | |
size | enum | Font size of text One of: xxsmall , xsmall , small , medium , large , xlarge , xxlarge , 1/2 , 1/3 , 2/3 , 1/4 , 2/4 , 3/4 , full , auto , unset | |
style | enum | Font style of text One of: unset , normal , inherit , initial , italic , oblique | |
weight | enum | Font weight of text One of: unset , normal , bold , bolder , lighter , 100 , 200 , 300 , 400 , 500 , 600 , 700 , 800 , inherit , initial |
<Text color="brand" size="xxsmall" family="serif" weight="normal" style="normal"> Text 1 </Text> <Text color="light-2" size="xsmall" family="sans-serif" weight="bold" style="italic"> Text 2 </Text> <Text color="light-4" size="small" family="monospace" weight="bolder" style="oblique"> Text 3 </Text> <Text color="light-6" size="medium" family="cursive" weight="lighter" style="normal"> Text 4 </Text> <Text> Text 5 </Text> <Text color="dark-2" size="large" family="fantasy" weight="100" style="italic"> Text 6 </Text> <Text color="dark-4" size="xlarge" family="Helvetica" weight="800" style="oblique"> Text 7 </Text> <Text color="dark-6" size="xxlarge" family="Helvetica, Arial, sans-serif" weight="unset" style="unset"> Text 8 </Text>
TextArea
Prop name | Type | Default | Description |
---|---|---|---|
borderColor | enum | A borderColor identifier One of: brand , accent-1 , accent-2 , accent-3 , accent-4 , neutral-1 , neutral-2 , neutral-3 , neutral-4 , error , warning , success , unknown , disabled , light-1 , light-2 , light-3 , light-4 , light-5 , light-6 , dark-1 , dark-2 , dark-3 , dark-4 , dark-5 , dark-6 , transparent | |
children | any | Content inside the TextArea element | |
cols | number | Specifies the visible width of a text area | |
disabled | boolean | Specifies that a text area should be disabled | |
maxlength | number | Specifies the maximum number of characters allowed in the text area | |
placeholder | string | Specifies a short hint that describes the expected value of a text area | |
rows | number | Specifies the visible number of lines in a text area |
Default TextArea
Prop name | Type | Default | Description |
---|---|---|---|
children | any | Required | Content inside the Theme Wrapper |
theme | ThemeConfig | Custom theme config object |