knotty
This is a style guide and directory of reusable components for Enwoven.

This is a style guide and directory of reusable components for Enwoven.
Prop name | Type | Default | Description |
---|---|---|---|
theme | shape | Shape |
primaryColorLight
primaryColor
primaryColorDark
greyLight
grey
greyDark
greyNeutral
error
Prop name | Type | Default | Description |
---|---|---|---|
theme | shape | Shape |
Light, Font-size 42px, Line-height 54px
className="weight-light"
Bold, Font-size 42px, Line-height 54px
Bold, Font-size 36px, Line-height 40px
Bold, Font-size 24px, Line-height 28px
Bold, Font-size 18px, Line-height 24px
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vel libero euismod, volutpat nibh id, facilisis risus. Mauris vel hendrerit tellus. Praesent eu ligula eget lacus pharetra lacinia ac vitae nisl. Sed vitae dictum sem. Proin ut turpis ut tortor iaculis dignissim elementum ut enim.
Regular, Font-size 14px, Line-height 20px
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vel libero euismod, volutpat nibh id, facilisis risus. Mauris vel hendrerit tellus. Praesent eu ligula eget lacus pharetra lacinia ac vitae nisl. Sed vitae dictum sem. Proin ut turpis ut tortor iaculis dignissim elementum ut enim.
Regular, Italic, Font-size 14px, Line-height 20px
className="italic-text"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vel libero euismod, volutpat nibh id, facilisis risus. Mauris vel hendrerit tellus. Praesent eu ligula eget lacus pharetra lacinia ac vitae nisl. Sed vitae dictum sem. Proin ut turpis ut tortor iaculis dignissim elementum ut enim.
Bold, Font-size 14px, Line-height 20px
className="weight-bold"
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vel libero euismod, volutpat nibh id, facilisis risus. Mauris vel hendrerit tellus. Praesent eu ligula eget lacus pharetra lacinia ac vitae nisl. Sed vitae dictum sem. Proin ut turpis ut tortor iaculis dignissim elementum ut enim.
Bold, Italic, Font-size 14px, Line-height 20px
className="weight-bold italic-text"
Default link: Regular, Font-size 16px
Link may be wrapped inside another typography tag, in which case it will match that styling.
Note: for buttons styled likelinks or links styled like buttons, see Button component.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Integer vel libero euismod, volutpat nibh id, facilisis risus. Mauris vel hendrerit tellus. Praesent eu ligula eget.
Regular, Font-size 18px, Line-height 26px
Regular, Font-size 14px, Line-height 20px
Regular, Font-size 14px, Line-height 20px
Nested ul for nested list items get className="nested-list"
Prop name | Type | Default | Description |
---|---|---|---|
children | node | Required | |
customClassClosed | string |
| Custom class for open wrapping children in closed mode |
customClassOpen | string |
| Custom class for open wrapping children in open mode |
The Accordion
element generally expects two child nodes, a "top" and a "bottom" node.
<Accordion customClassOpen="qAndaOpen" customClassClosed="qAndaClosed">
<div className="qClass" style={{ backgroundColor: 'white', border: '1px solid black', padding: '30px', }}>
My Question
</div>
<div className="aClass" style={{ backgroundColor: 'white', border: '1px solid red', padding: '30px', }}>
<p>My Answer 1</p>
<p>My Answer 2</p>
</div>
</Accordion>
Prop name | Type | Default | Description |
---|---|---|---|
children | node | Required | |
onClick | func | Required | |
dontCollapseIfOnlyOneOption | bool | false | |
moreIconClass | string | fa-ellipsis-h | |
moreText | string | More | |
optionsToShow | number | 3 | |
optionsWrapperClassname | string |
| |
optionsWrapperStyles | object | Shape | |
textAlign | enum | null | One of: left , right , center |
tooltipMenuProps | object | Shape | |
useDropdownStyleForMoreActions | bool | false |
The ActionBar
element has an exposed Option
object that is used to add options. This is the only allowed child type.
Note: only options being shown can be disabled
<ActionBar onClick={(value) => { alert(value); }} optionsToShow={3}>
<ActionBar.option value="view" iconClass="fa-search" disabled>View</ActionBar.option>
<ActionBar.option value="edit" iconClass="fa-pencil" highlighted>Edit</ActionBar.option>
<ActionBar.option value="option" iconClass="fa-check-box-outline-blank">Select</ActionBar.option>
<ActionBar.option value="copy" iconClass="fa-copy-btl">Copy</ActionBar.option>
<ActionBar.option value="move" iconClass="fa-move">Move</ActionBar.option>
</ActionBar>
An onClick
callback will pass the value
attribute specified on each ActionBar.option
.
You can specify to not add the "More" menu if there's only one option.
The ActionBar container is flexible and will expand width-wise to fill its parent container.
The number of options shown is configurable, in addition to the "More" text and iconClass.
Prop name | Type | Default | Description |
---|---|---|---|
children | node | Required | |
backgroundColor | string | null | |
collapse | bool | false | |
textColor | string | null |
Prop name | Type | Default | Description |
---|---|---|---|
buttonStyle | enum | normal | Button's style type One of: normal , primary , inverse , textLink , plain , transparent , tertiary , secondary , flat |
children | node |
| So many kids. |
className | string |
| |
color | union | null | Override the colour of the button text One of type: number, string |
dataTestTarget | string |
| Provide a property that can be targeted by Selenium tests |
disabled | bool | false | |
href | string |
| Pass |
iconClass | string | null | |
iconImgSrc | bool | false | Set to true if iconClass is actually an img src |
iconRight | bool | false | |
id | string |
| id to tag the button component for targetting |
isFullWidth | bool | false | Set true if button should be full-width, else leave blank |
loading | bool | false | |
minHeight | union | 0 | One of type: number, string |
minWidth | union | 0 | One of type: number, string |
noUnderline | bool | true | |
onClick | func | Function | Function to call when button is clicked |
size | enum | normal | Size of the button One of: normal , large , small , fill |
Pass the function for the action to be called by that button in the onClick
prop. Alternatively, pass an href
prop for <a />
functionality instead.
<Button onClick={(e) => alert('Clicky clicky!', e.target)}>Click me</Button>
Use any of the available button style types to quickly create a styled button. Just modify the buttonStyle
prop.
Modify the size
prop to select the button size, or make the button block level by adding the isFullWidth
prop.
Choosing fill
as the size prop will cause the button to fill the available space inside its parent container. It achieves this using CSS3 flexbox, so the parent container must use display: flex
.
By default, the <Button />
component generates a <button />
DOM element tag. If you need a link that uses button styling, pass a link in the href
prop and it will make a <a />
element instead.
Prop name | Type | Default | Description |
---|---|---|---|
checkboxStyle | enum | none | One of: none , white , standard , primary-color-light , primary-color |
checked | bool | false | |
dataTestTarget | string |
| |
disabled | bool | false | |
error | bool | false | |
label | string |
| |
name | string |
| |
onClick | func | Function | |
value | string |
|
Prop name | Type | Default | Description |
---|---|---|---|
onClick | func | Required | |
children | node | false | |
dataTestTarget | string |
| Provide a property that can be targeted by Selenium tests |
disabled | bool | false | |
iconClass | string | fa-plus | |
iconHoverClass | string | fa-plus-circle | |
iconPosition | enum | top | One of: top , bottom |
id | string |
| id to tag the button component for targetting |
inlineIcon | bool | false |
Prop name | Type | Default | Description |
---|---|---|---|
callbackFunction | func | Function | |
disabled | bool | false | |
fontColor | enum | null | One of: black , white , grey |
initialValue | string |
| Initial date for the input |
inputClassName | string |
| |
inputId | string | input-date | |
label | string |
| |
name | string | name | |
prefixDate | string | Enter today:␣ | prefixDate, string to append on additional date |
savingTxt | string |
| |
showAutoFillBtn | bool | false | |
showHelperDateMessage | bool | false | |
styleInput | shape | Shape | color : stringfontSize : numberbackgroundColor : string |
value | string |
| Date to be currently shown |
<DateInput />
Prop name | Type | Default | Description |
---|---|---|---|
children | node | Required |
The Netscape Navigator of the modern times: Internet Explorer. The children of this component will not be rendered in IE. It also includes a utility function getIeVersion
for use in other components. getIeVersion
returns false is the browser is not internet explorer.
The following example will not render in IE:
Prop name | Type | Default | Description |
---|---|---|---|
isOpen | bool | Required | |
onRequestClose | func | Required | |
children | node | <noscript /> | |
customClass | string |
| add a custom css class to the modal body |
darkOverlay | bool | false | |
headerChildren | unknown | <noscript /> | |
onAfterOpen | func | null | |
size | enum | default | One of: default , large , full |
Prop name | Type | Default | Description |
---|---|---|---|
buttonStyle | enum | primary | Button style. One of: primary , normal |
children | custom |
| Only |
customTrigger | node | null | |
defaultValue | union |
| What to show when nothing is selected now we need to make it a div too One of type: string, element |
disableIconArrows | bool | false | |
disabled | bool | false | Function to call when button is clicked |
error | bool | false | |
isFullWidth | bool | false | Set to true if the dropdown button should be full-width, else leave blank |
minHeight | number | 0 | |
minWidth | number | 0 | |
onChange | func | Function | |
optionsToShow | number | -1 | limit the options that is shown in a the dropdown before a scrollbar is shown. -1 means to show all items. |
optionsWrapperClassname | string |
| |
optionsWrapperStyles | object | Shape | |
showPrefix | string |
| Append to the start of the button's displayed text |
showSuffix | string |
| Append to the end of the button's displayed text |
size | enum | normal | "largelarge" will also set the dropdown options to be large size One of: normal , large , largelarge , largelargeicons |
textAlign | enum | left | Aligning text of the dropdown button One of: left , center , right |
value | string |
|
The Dropdown
element has an exposed option
object that is used to add options. This is the only allowed child type.
<Dropdown value={"one"}>
<Dropdown.option value={"one"}>I'm the default</Dropdown.option>
<Dropdown.option value={"two"}>Hey</Dropdown.option>
<Dropdown.option value={"three"}>how you doin'?</Dropdown.option>
</Dropdown>
Specify a string via defaultValue
prop, which will display in the button when nothing is selected. As soon as a selection is made, the string disappears. This mitigates situations where want to force the user to pick an item, but don't want to include a default option in the dropdown that can be selected again.
Three options:
Five options
seven options
By default, the dropdown expands based on the width of the longest string of th text from its options. Specify a minimum width with the minWidth
prop if you want something longer.
Prop name | Type | Default | Description |
---|---|---|---|
flameHeight | number | 120 |
Add some extremely subtle flare to your page. It will only work if you have at least 37 pieces on (but no less than 15).
Prop name | Type | Default | Description |
---|---|---|---|
children | node | Required | |
title | node | Required | Text, button, or any other element. This element will be displayed as the title section of the element, aligned on the left side of the bar on a single line. |
fixedPosTop | string | 0 | |
isFixed | bool | false | |
midsection | node | null | This optional element occupies the middle section of the bar, within whatever space is left over from the title and trigger elements. |
onClick | func | Function | a callback for when a menu option is clicked on. It will return the option's value prop |
onMenuClose | func | Function | |
overrideClose | node | null | Override the close button being displayed on menu open |
scrollElementSelector | string | null | If the menu trigger is inside an element that scrolls, give a reference to the parent container so that scroll events can be handled correctly. This is a CSS selector. |
trigger | node | <div style={{ fontSize: '30px', }}><i className="fa fa-hamburger" /></div> | Text, button, or any other element. This element will be displayed as the "trigger" for showing the tooltip. Clicking anywhere inside this element will show/hide the tooltip. |
Specific variant of TooltipMenu that is used for navigation-style header bars.
<div>
<FullWidthMenu title={'My Title'} onClick={(value) => { alert(value); }}>
<FullWidthMenu.option value='copy'><i className="fa fa-copy-btl" />Copy</FullWidthMenu.option>
<FullWidthMenu.option value='move'><i className="fa fa-move" />Move</FullWidthMenu.option>
<FullWidthMenu.option value='down'><i className="fa fa-download" />Download</FullWidthMenu.option>
</FullWidthMenu>
</div>
Prop name | Type | Default | Description |
---|---|---|---|
isOpen | bool | Required | |
onRequestClose | func | Required | |
children | node | <noscript /> | |
crazy | bool | false | Only if you are feeling wild. |
customClass | string |
| add a custom css class to the modal body |
dontFuckWithOverflow | bool | false | |
headerChildren | node | <noscript /> | |
onAfterOpen | func | null | |
onBackClick | func | null | |
showCloseButton | bool | true | |
showTopRightInfo | bool | true | |
size | enum | default | One of: default , large , full |
subHeader | node | null | |
title | string |
| |
verticallyCentered | bool | false |
Prop name | Type | Default | Description |
---|---|---|---|
closeTiming | enum | null | One of: long , short |
customTime | number | null | |
inline | bool | false | When using the inline property, it will render the notification inline, instead of within a modal |
isOpen | bool | false | |
message | string |
| |
onRequestClose | func | Function | |
showCloseButton | bool | false |
Notifications and such.
Prop name | Type | Default | Description |
---|---|---|---|
currentPage | number | 1 | |
disableLimitSet | bool | false | Disable display of the limit set |
disablePageSet | bool | false | Disable display of the goto page |
disableTotal | bool | false | Disable display of the total results |
limit | number | 20 | |
onPageSelect | func | Function | Callback that gets passed an object with current "page" and current "limit" |
total | number | 0 |
The PaginationBar helps to navigate paginated data. Users can select specific pages via the page blocks, or the page setter input and dropdown. The number of per-page entries can also be set.
All elements apart from the central page numbers element can be toggled.
Prop name | Type | Default | Description |
---|---|---|---|
cylon | bool | false | Cylon mode! |
logoUrl | string | https://www.enwoven.com/assets/144x144.png | |
max | number | 100 | |
title | string | Loading... | |
transitionDuration | number | 500 | |
value | number | 100 |
This is a progress bar component, thanks.
Get a bare progress bar by setting logoUrl
and title
to empty strings.
The width stretches to fill the parent container.
Prop name | Type | Default | Description |
---|---|---|---|
name | string | Required | |
value | string | Required | |
checked | bool | false | |
dataTestTarget | string |
| |
disabled | bool | false | |
error | bool | false | |
label | string |
| |
onClick | func | Function |
This is a "dumb" implementation of the radio element. They aren't aware of each other, so you'll have to manage their checked or unchecked state via a parent component's state.
class RadioExample extends React.Component {
constructor(props) {
super(props);
// decide which one gets selected by default
this.state = {
selected: "1",
}
this.onClick = this.onClick.bind(this);
}
onClick(e, params) {
this.setState({
selected: params.value,
});
}
render() {
// the "checked" prop is decided by this component's state.
return (
<div>
<Radio
checked={this.state.selected === "1"}
name="radio"
label="1"
value="1"
onClick={this.onClick}
/>
<Radio
checked={this.state.selected === "2"}
name="radio"
label="2"
value="2"
onClick={this.onClick}
/>
<Radio
checked={this.state.selected === "3"}
name="radio"
label="3"
value="3"
onClick={this.onClick}
/>
</div>
);
}
}
<RadioExample1 />
Prop name | Type | Default | Description |
---|---|---|---|
allowClearText | bool | true | |
allowLinkNewWindow | bool | false | |
allowMentions | bool | false | |
buttonList | enum[] | [
'bold', 'italic', 'underline', 'hyperlink', 'headline', 'blockquote',
'unordered-list', 'ordered-list',
] | |
disabled | bool | false | |
error | bool | false | |
height | union | 100% | One of type: number, string |
helpText | string |
| |
initialValue | union |
| Changing initialValue will reset the state, useful for reuse One of type: object, string |
initialValueRaw | object | null | |
label | string |
| |
limit | number | 0 | |
mentionOnAdd | func | Function | |
mentionOnClick | func | null | |
mentionSearchChange | func | Function | |
mentionSuggestions | array | [] | |
onChange | func | Function | |
onSave | func | Function | |
placeholder | string | Click here to enter text | |
statusText | string |
| |
transparent | bool | false | |
width | union | 100% | One of type: number, string |
... and some other stuff. The underlining and html tags are to test xss issues with input text parsing.
block this, yass.
and this two
one more for good luck
Saving text:
Option to have links open in new window:
Setting transparent
will make the text input transparent with white text.
A character count and limit can be displayed using the limit
option.
When the text length exceeds the limit, the error styling is applied,
the status text displays the number of characters by which the text exceeds the limit,
and the changes do not save.
Raw data input from the text editor itself can be provied to a new instance of the editor via initialValueRaw
block this, yass.
and this two
one more for good luck
Prop name | Type | Default | Description |
---|---|---|---|
children | node | null |
It's a table. As such, it needs no introduction but, well, here we are.
ID | Title | Owner | Privacy | Visibility | Options |
---|---|---|---|---|---|
One | Here is a great title | Not Jerry | Very | 20/20 | Click! |
2 | Higgilty piggilty | Mister Donut | Really | Good | |
76 | Nice project buddy | Miss Congeniality | Private ;-) | Public |
ID | Title | Owner | Privacy | Visibility | Options |
---|---|---|---|---|---|
One | Here is a great title | Not Jerry | Very | 20/20 | Click! |
2 | Higgilty piggilty | Mister Donut | Really | Good | |
76 | Nice project buddy | Miss Congeniality | Private ;-) | Public |
Prop name | Type | Default | Description |
---|---|---|---|
children | node | Required | |
customClass | string |
| Custom CSS class for title |
customParentClass | string |
| |
customTabsClass | string |
| Custom CSS class for tabs list |
customWrapperClass | string |
| |
freezeTabList | bool | false | Set the side navigation title and tab items to remain in place for vertical orientation. |
index | number | 0 | Optionally, set the currently selected tab index via this prop. Tabs are 0-indexed |
onTabClick | func | Function | |
orientation | enum | horizontal | Stack the tabs horziontally on the top (content on bottom), or left side vertically (content on right) One of: horizontal , vertical |
title | string |
|
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi mattis libero ac porta rhoncus. Fusce vel lectus consequat, tristique ante lacinia, hendrerit magna. Sed vel nunc et nisi semper euismod sed non nisi. Ut eu ipsum euismod, viverra odio non, pellentesque lectus. Duis mollis nisi eget hendrerit bibendum. Nunc interdum urna et quam sagittis, ut aliquam tellus tempus. Vivamus aliquam elit eu ipsum scelerisque laoreet. Nulla tincidunt justo non sapien consequat malesuada. In eu sem vitae turpis auctor varius ac vitae est. In hac habitasse platea dictumst. Nulla facilisi. Ut eget nunc vel dolor ultricies lacinia at vel velit. Fusce dapibus id nibh vitae condimentum. Aenean fringilla vel tellus pellentesque cursus.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi mattis libero ac porta rhoncus. Fusce vel lectus consequat, tristique ante lacinia, hendrerit magna. Sed vel nunc et nisi semper euismod sed non nisi. Ut eu ipsum euismod, viverra odio non, pellentesque lectus. Duis mollis nisi eget hendrerit bibendum. Nunc interdum urna et quam sagittis, ut aliquam tellus tempus. Vivamus aliquam elit eu ipsum scelerisque laoreet. Nulla tincidunt justo non sapien consequat malesuada. In eu sem vitae turpis auctor varius ac vitae est. In hac habitasse platea dictumst. Nulla facilisi. Ut eget nunc vel dolor ultricies lacinia at vel velit. Fusce dapibus id nibh vitae condimentum. Aenean fringilla vel tellus pellentesque cursus.
Tabs consist of several related elements in the following form:
import { Tabs, TabList, Tab, TabPanel, } from 'Tabs';
const MyComponent = () => (
<Tabs>
<TabList>
<Tab>One</Tab>
<Tab>Two</Tab>
<Tab>Three</Tab>
</TabList>
<TabPanel>Content One</TabPanel>
<TabPanel>Content Two</TabPanel>
<TabPanel>Content Three</TabPanel>
</Tabs>
);
Tab elements can either be imported separately, as shown above, or can be referenced statically from the top-level Tabs
component:
import Tabs from 'Tabs';
const MyComponent = () => (
<Tabs>
<Tabs.List>
<Tabs.Tab>One</Tabs.Tab>
<Tabs.Tab>Two</Tabs.Tab>
<Tabs.Tab>Three</Tabs.Tab>
</Tabs.List>
<Tabs.Panel>Content One</Tabs.Panel>
<Tabs.Panel>Content Two</Tabs.Panel>
<Tabs.Panel>Content Three</Tabs.Panel>
</Tabs>
);
Other notes:
<TabList />
must be the first child of Tabs
Tab
s must be equal to the number of TabPanel
sTabPanel
s are removed from the DOM when they are hidden.Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi mattis libero ac porta rhoncus. Fusce vel lectus consequat, tristique ante lacinia, hendrerit magna. Sed vel nunc et nisi semper euismod sed non nisi. Ut eu ipsum euismod, viverra odio non, pellentesque lectus. Duis mollis nisi eget hendrerit bibendum. Nunc interdum urna et quam sagittis, ut aliquam tellus tempus. Vivamus aliquam elit eu ipsum scelerisque laoreet. Nulla tincidunt justo non sapien consequat malesuada. In eu sem vitae turpis auctor varius ac vitae est. In hac habitasse platea dictumst. Nulla facilisi. Ut eget nunc vel dolor ultricies lacinia at vel velit. Fusce dapibus id nibh vitae condimentum. Aenean fringilla vel tellus pellentesque cursus.
Prop name | Type | Default | Description |
---|---|---|---|
label | string | Required | |
disabled | bool | false | |
onClick | func | Function | a callback for when the "x" button is clicked.
It is passed two arguemnts: |
value | union | One of type: shape, string |
Prop name | Type | Default | Description |
---|---|---|---|
name | string | Required | |
autoComplete | enum | off | One of: on , off |
caption | bool | false | |
dataTestTarget | string |
| Provide a property that can be targeted by Selenium tests |
dataTestTargetSuggestions | string | data-suggestions-list | Provide a property for suggestions that can be targeted by Selenium tests |
disabled | bool | false | |
error | bool | false | |
fontSize | number | 0 | |
helpText | string |
| |
iconClass | string | null | |
label | string |
| |
limit | number | 0 | |
lineSpacing | enum | null | One of: single , double , halfsies |
multiline | bool | false | if true, use a |
onBlur | func | Function | |
onChange | func | Function | |
onFocus | func | Function | |
onKeyUp | func | Function | |
onSuggest | func | Function | |
placeholder | string |
| |
resizable | bool | true | |
savingTxt | string |
| top right placement normally used for saving indicator |
size | enum | normal | Size of the text input One of: normal , large , flex , fit |
style | enum | normal | style One of: normal , inverse , inverse-transparent |
suggestions | any[] | [] | |
textAlign | enum | left | One of: left , right , center |
type | string | text | |
value | string |
|
Because they both share many properties, textarea
and <input type="text" />
have been merged into a single TextInput
component. Toggle usage by setting multiline
to true
or false
accordingly.
Setting style to transparent-inverse
will make the text input / textarea transparent with white text.
Setting size to flex
allows the width and height of the textinput to fill the surrounding parent div.
Setting size to flex
allows the width and height of the textinput to fill the surrounding parent div.
A character limit may be imposed with the limit
option.
Exposing some of the native JS events of the internal input field: focus
and select
Prop name | Type | Default | Description |
---|---|---|---|
animate | bool | true | |
baseClass | string | bootstrapSwitch | |
bgColorOn | string |
| |
bsSize | string | null | |
defaultValue | bool | true | |
disabled | bool | false | |
handleWidth | union | auto | One of type: string, number |
inverse | bool | false | |
labelText | node | ␣ | |
labelWidth | union | auto | One of type: string, number |
offColor | string | Default | |
offText | node | OFF | |
onChange | func | Function | |
onColor | string | Primary | |
onText | node | ON | |
readonly | bool | false | |
tristate | bool | false | |
value | bool | undefined | |
wrapperClass | string | wrapper |
Mini
Mini
Regular
Large
Custom Text
Label Text
Disabled
Trigger Function
Override Color
Prop name | Type | Default | Description |
---|---|---|---|
children | node | Required | |
active | enum | hover | One of: hover , trigger |
ctaButton | shape | null | name : stringcallback : func |
dismissOnClick | bool | false | Dismiss by clicking on the tooltip itself |
isModal | bool | false | |
message | string | Popover Rules | |
overridePlacement | shape | null | Override for a placement and size of the tooltip, good for when tooltip will not move its spot yPos: translate Y, mandatory if use xPos xPos: translate X, mandatory if use yPos width: set width string of tooltip height: set height string of tooltip yPos : numberxPos : numberwidth : stringheight : string |
position | enum | top | One of: top , bottom , left , right |
scrollElementSelector | string | null | |
timeout | number | 2000 | |
title | string | null |
Prop name | Type | Default | Description |
---|---|---|---|
children | node | Required | |
trigger | node | Required | Text, button, or any other element. This element will be displayed as the "trigger" for showing the tooltip. Clicking anywhere inside this element will show/hide the tooltip. |
allowClickPropagation | bool | false | When enabled, click events for the trigger will propagate upwards to parent components |
disableDismissMenuOnClick | bool | false | when true, menu will not dismiss on a selection of a menu click |
menuOffsetX | number | 0 | |
menuOffsetY | number | 0 | |
onClick | func | Function | a callback for when a menu option is clicked on. It will return the option's value prop |
onMenuClose | func | Function | |
overridePlacement | shape | null | position : stringtop : stringleft : string |
placementTooltip | enum | default | placementToolip to define where the tooltip will reside , includes arrow and container One of: default , right |
positionTooltip | enum | top | One of: top , left |
scrollElementSelector | string | null | If the menu trigger is inside an element that scrolls, give a reference to the parent container so that scroll events can be handled correctly. This is a CSS selector. |
showArrow | bool | true | |
toTheLeftToTheLeft | bool | false |
Similar to the Dropdown component, the only allowable child for TooltipMenu are TooltipMenu.option
. Pass any element to the trigger
prop will display the passed element as a clickable area which, upon clicking, will show the menu:
// Pass a button to be displayed that a user can click on.
// no need to specify any onClick handlers.
const trigger = (
<Button>
Click me.
</Button>
);
const MyComp = () => (
<TooltipMenu trigger={trigger}>
<TooltipMenu.option value="one">First option</TooltipMenu.option>
<TooltipMenu.option value="two">Second option</TooltipMenu.option>
<TooltipMenu.option value="three">Third option</TooltipMenu.option>
</TooltipMenu>
);
Passing a custom method to onClick
will invoke that method on option click, passing the supplied value
prop as the only param.
The children of any Tooltipmenu.option
s can be any valid element.
The trigger
prop can be any valid element:
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla tincidunt finibus dui at scelerisque. Pellentesque tincidunt quam sit amet nisl mattis eleifend. Sed vitae dignissim nibh. Ut in suscipit ipsum. Donec placerat laoreet ante vel suscipit. Proin feugiat et est nec mollis. Phasellus scelerisque urna consectetur lectus euismod, a efficitur nunc fermentum. Suspendisse a purus vel enim bibendum fringilla ac et odio. Nulla facilisi.
Pellentesque pellentesque risus vel purus tristique, nec rhoncus lectus blandit. Nulla maximus fermentum augue, eget tempus nulla consectetur at. Nullam id ultricies purus. Mauris turpis augue, maximus eget tortor eu, commodo malesuada turpis. Nullam aliquam dictum urna, quis aliquet diam ultricies ac. Nam facilisis ullamcorper odio eu iaculis. Donec blandit eleifend velit nec condimentum.
Prop name | Type | Default | Description |
---|---|---|---|
children | node | null | |
onDelete | func | null | |
onDownload | func | null | |
onEdit | func | null | |
showVolume | bool | false | |
title | string |
|
Branded audio player and such.
Prop name | Type | Default | Description |
---|---|---|---|
buttonName | string | Copy link | |
confirmMessage | string | URL copied | |
isModal | bool | false | |
onCopy | func | Function | |
tooltipOverridePlacement | shape | null | yPos : numberxPos : numberwidth : stringheight : string |
tooltipPos | enum | top | One of: top , bottom , left , right |
value | string | http://any/url/you/want.me |
Prop name | Type | Default | Description |
---|---|---|---|
src | string | Required | |
aspectRatio | number | NaN | |
cancelButtonStyle | string | normal | |
className | string |
| |
customClassName | string |
| |
onCropEnd | func | Function | |
onCropSave | func | Function | A call back method that will return the following:
1) image blob data from |
onCropStart | func | Function | |
onRotate | func | Function | This callback method is called after each rotation. |
saveButtonStyle | string | primary |
Method name | Parameters | Description |
---|---|---|
doRotate() | Programmatic way of performing rotation. | |
doCrop() | Programmatic way of starting crop mode. |
Crop and Rotate image functionality. And stuff.
Note: There is no server-side backend to dynamically update the image for this demo; the image will not be saved when switching between modes.
Prop name | Type | Default | Description |
---|---|---|---|
children | node | Required | |
isOpen | bool | Required | |
onRequestClose | func | Required | |
allowTitleSort | bool | true | |
className | string |
| |
headerDescriptionText | string | Drag rows and hit save | |
headerTitleText | string | Title | |
isLoading | bool | false | |
items | unknown | [] | |
modalTitle | string | Rearrange | |
onClickSave | func | Function | |
prefixRows | custom[] | [] | |
showThumbnail | bool | true | |
size | enum | large | One of: default , large |
suffixRows | custom[] | [] |
Well now.
Prop name | Type | Default | Description |
---|---|---|---|
actionBarItems | shape[] | [] | An array contain ActionBar.option props, in the following format: value : string — Value pass via onClick callbackiconClass : string — ActionBar item iconhighlighted : bool — ActionBar highlight of selectiondisabled : bool — ActionBar disabling of selectionlabel : string — Actionbar item texthref : string — Actionbar add href to make button an anchor tag |
actionBarProps | shape | Shape | Props to be passed to the internal ActionBar component optionsToShow : numberonClick : functextAlign : enummoreText : stringmoreIconClass : string |
addWarningIcon | bool | false | AARP Confetti Warning Icon |
altDesign | bool | true | Alternative GridItem design, with elements rearranged from default |
altMediaName | string | media | alternate name for the grid content |
appendChildren | node | null | any other components to append to the bottom of the grid item |
baseClassName | string |
| |
borderColor | string | null | |
className | string |
| |
clickableGridItem | bool | false | attribute basically that the whole grid item is clickable and gives curser: pointer value |
columnSpacing | number | 10 | Space between columns, in pixels |
columnSpan | number | 1 | |
customOverlay | node | null | |
dividerColor | string | null | |
dividerWidth | number | 0 | |
draggable | bool | null | |
draggablePrefixAdditions | node | undefined | |
draggableText | string | Drag Me | |
forceRowHeight | string | null | |
iconClass | string |
| Fortawesome classes for icons that appear in top right. Multiple icons separated by a space |
imagePrefixAdditions | node | undefined | |
imageUrl | string | https://www.enwoven.com/assets/default-project-thumb.png | url for the preview thumbnail |
imageUrlAnchor | string | null | creates an anchor tag of the surrounding image USED for right clicking |
inPlaceDragDrop | bool | false | |
isPreview | bool | false | |
label | string |
| |
noHoverEffect | bool | false | disables accent color for paragraph text at the bottom of the grid item and sets cursor to default arrow so people don't expect a link there |
noOverlay | bool | false | |
onDrag | func | Function | |
onDragStart | func | Function | |
onDragStop | func | Function | |
onImageClick | func | Function | |
onOverlayClick | func | Function | |
onTitleClick | func | Function | |
overlayText | string |
| Text that appears in top left of thumbnail on hover |
preserveImageAspectRatio | bool | false | by default, images are stretched to fille available space. Use this to preserve that sweet aspect ratio. |
rowSpacing | number | -1 | |
rowSpan | number | 1 | |
showActions | bool | true | |
showStackItem | bool | false | |
showTitle | bool | true | Show/Hide the title area completely. |
titleText | union |
| Text that appears on bottom-most area of grid item. One of type: string, node |
wild | bool | false | cray cray af, fam |
Okay guys and gals, it's a Grid Item.
When no overlay is present, you may optionally supply a callback to onImageClick
.
Prop name | Type | Default | Description |
---|---|---|---|
onClick | func | Required | |
buttonName | string | Is Button | |
disabled | bool | false | |
iconClass | string | fa-plus | |
size | enum | normal | One of: normal , large |
Prop name | Type | Default | Description |
---|---|---|---|
cylon | bool | true | |
max | number | 100 | |
offsetTipX | number | 0 | X-coord offset for the tooltip, to adjust its position further |
offsetTipY | number | 0 | Y-coord offset for the tooltip, to adjust its position further |
onPageChange | func | Function | |
resetTooltipOrigin | bool | false | Zero out the top and left origin of the page number Tooltip |
value | number | 1 |
Note: Since Page Progress Bar internally uses a themed version of Progress Bar, it needs to be wrapped externally by a ThemeProvider.
Prop name | Type | Default | Description |
---|---|---|---|
onAddTag | func | Required | Callback when tag has been added |
onChange | func | Required | onChange callback from input field |
onDeleteTag | func | Required | Callback when removing a tag |
value | string | Required | |
caseSensitive | bool | false | When adding a new tag, whether checks should be case sensitive |
disabled | bool | false | disabled input |
focusTimeout | number | 0 | Optional override of the timeout interval to regain focus on the input |
label | string | label | |
name | string | taginput | |
onBlur | func | Function | |
onFocus | func | Function | |
placeholder | string | Tag Input | placeholder of the input |
savingTxt | string |
| top right placement normally used for saving indicator |
suggestedTags | shape[] | [] |
label : stringvalue : string |
tags | shape[] | [] | Tags is an array of tags. Tags are objects in the following form: label : stringvalue : string |
Prop name | Type | Default | Description |
---|---|---|---|
children | node | Required | |
className | string |
| |
columnSpacing | number | 10 | |
columnSpan | number | 1 | |
ddThrottle | bool | true | Don't set this to false unless you know what you're doing. |
dividerWidth | number | 0 | |
draggable | bool | false | |
forceColumnCount | number | 0 | |
forceRowHeight | string | null | |
highlightDropWidth | number | 4 | |
inPlaceDragDrop | bool | false | |
labels | string[] | null | |
onDragStop | func | Function | Callback when a drag event is done, passing in an object with before and after arrays of the GridItems |
onResize | func | Function | |
rowSpacing | number | 10 | |
rowSpan | number | 1 | |
useFlexLayout | bool | false |
A Grid layout accepts one or more grid items and places them into columns and rows depending on the layout's avaiable width.
Resize to your heart's content. Columns are determined by container pixel width:
small | medium | large | x-large | |
---|---|---|---|---|
Width | < 768px | >= 768px | >= 992px | >= 1200px |
Columns | 2 | 3 | 4 | 6 |
A theme is a plain javascript object. It takes the following format:
{
colors: {
primaryColorLight: "var(--knotty-primary-color-light)",
primaryColor: "var(--knotty-primary-color)",
primaryColorDark: "var(--knotty-primary-color-dark)",
greyLight: "#f3f6f9",
grey: "#a5a5a5",
greyDark: "#2e2e2e",
error: "#c02519",
},
typography: {
primaryFont: "'Open Sans', sans-serif",
},
Button: {/*... button-related properties ... */},
Checkbox: {/*... checkbox-related properties ... */},
/* ... etc, */
}
knotty providers a default theme to show you what values can be overridden. You can use a theme by simply importing:
// internally, inside knotty.
import { themes, } from 'themes';
// inside THP-V3... soon :)
import { themes, } from 'features/dls';
// access the default theme:
const defaultTheme = themes.default;
All knotty components will use the default theme if none is explicitly provided. To use a different theme, you must provide it with the ThemeProvider
component, as follows:
import React from 'react';
import { render, } from 'react-dom';
import { ThemeProvider, themes, } from 'features/dls';
import { MyIndexView, } from 'my-app';
render(
<ThemeProvider theme={themes.default}>
<MyIndexView />
</ThemeProvider>,
document.getElementById('root')
);
ThemeProvider
does not need to be a top-level component; however, only components which are children of ThemeProvider
will pick up on the provided theme.
This example above explicitly uses the default theme (a little redundant), but merely demonstrates how to supply a specific theme. See below for how to customize or create your own theme.
Sometimes Ben or Ana want a slightly different shade of fuschia for one button on one page. Who are we to deny them?! Create a custom themed button with the withCustomTheme
higher order component:
import { ThemeProvider, withCustomTheme, } from 'features/dls';
const MyCustomThemedButton = withCustomTheme(Button, {
fontSize: '24px',
backgroundColor: '#ff00ff',
color: 'white',
minHeight: '64px',
});
Example as follows:
Any component that uses a custom theme must be a child of ThemeProvider
(nested or otherwise).
Using withCustomTheme
HOC works well if you need a one-off override for particular components. But suppose you need to make some more extensive changes which will affect all components, such as changing the primary-color, or primary font.
In these cases, you would need to create a custom theme and pass it into the top-level ThemeProvider theme's prop. Create custom themes by using the provided createTheme
function:
import { ThemeProvider, createTheme, themes, } from 'features/dls';
const customTheme = createTheme(
{ primaryColor: '#0000ff' },
{ primaryFont: 'Times New Roman', },
{
Button: {
normal: {
borderColor: 'blue',
borderWidth: '6px'
}
}
}
);
<ThemeProvider theme={customTheme}>
<React.Fragment>
<Button buttonStyle="primary">I'm changed.</Button><br /><br />
<Button buttonStyle="primary">Wow! I changed too.</Button>
<Button buttonStyle="normal">Normal!</Button>
</React.Fragment>
</ThemeProvider>
createTheme()
accepts three arguments: colors
, typography
, and overrides
.
All arguments are optional (but why would you do that?!). Take a look at what themes.default
looks like to see what key/values can be overridden.
The third argument, overrides
, is a plain javascript object that can be used to ...override any other parts of the default theme. Example of this is below, but more on this later.
Any key-value pairs you do not provide will automatically be inherited from the default theme.
The overrides
argument can also be useful for overwriting select properties as needed. For example, let's say that you want to create a theme that will override a primary button's border width property (for all instances of Button component):
const customTheme = createTheme(
themes.default.colors,
themes.default.typography,
{
Button: {
primary: {
borderWidth: '12px'
}
}
}
);
This will override a single property. As mentioned previously, all other default theme properites will be inherited.
Let's suppose you don't want to override any existing colors or typography, but just want to add something like a new color or property (to be used later). This can be achieved as follows:
// Method 1: just add some new custom values. all other key-value pairs, such as primaryColor, will be inherited
const myCustomTheme1 = createTheme(
{
myFoofColor: '#ff00ff',
burntSienna: '#e97451',
purpleDrank: '#6633ff',
},
{
eyeballBlastFont: 'Comic Sans MS',
}
);
// Method 2: you can add any custom properties to third `overrides` argument:
const myCustomTheme2 = createTheme(
{
myFoofColor: '#ff00ff',
burntSienna: '#e97451',
purpleDrank: '#6633ff',
},
{
eyeballBlastFont: 'Comic Sans MS',
},
{
subtleBorder: '100px solid #ff00ff',
reusableShadowValue: '0 0 5px rgba(0,0,0,0.5)',
}
);
You can reference newly added custom values (or any other theme values) by providing a string value that will resolve to the property. Let's say I want the primary button to reference some newly added custom properties:
const customTheme = createTheme(
{
myFoofColor: '#ff00ff',
},
{
eyeballBlastFont: 'Comic Sans MS',
},
{
anotherCustomColor: '#6633ff',
superFatBorderWidth: '100px',
Button: {
primary: {
color: 'colors.foof',
primaryFont: 'typography.eyeballBlastFont',
borderWidth: 'superFatBorderWidth',
hover: {
backgroundColor: 'anotherCustomColor',
}
}
}
}
);
Any custom properties can even be used by components that were created with withCustomTheme
HOC, as follows:
const customTheme = createTheme(
{ foof: '#ff00ff', reallyblue: '#0000ff' },
);
const MyCustomThemedButton = withCustomTheme(Button, {
fontSize: '22px',
backgroundColor: 'colors.reallyblue',
color: 'colors.foof',
});
<ThemeProvider theme={customTheme}>
<React.Fragment>
<Button>Normal button</Button><br /><br />
<MyCustomThemedButton>Soo blue and foofy</MyCustomThemedButton>
</React.Fragment>
</ThemeProvider>
If you need to access the current theme, it can be provided as a local prop with the withThemeProp
HOC:
import { withThemeProp } from 'features/dls';
class MyComponent extends React.Component {
render() {
console.log(this.props.theme);
//--- render, render, render,
}
}
export default withThemeProp(MyComponent)