/* ----- Card.jsx -------*/ import { border, color, space, layout } from '@styled-system/prop-types'; import PropTypes from 'react' // Apply proptypes from styled system + custom prop types Card.propTypes = { id: PropTypes.string.isRequired, variant: PropTypes.string, ...border, ...color, ...space, ...layout, } // Apply default props Card.defaultProps = { borderRadius: 2, bg: 'white', p: 2, variant: "" } /* ----- index.jsx -------*/ import Card from './Card' import { StyledSystemPropsTable as PropsTable } from 'styled-system-props-table' // This function will decorate the proptype data with additional info const transformProps = (name = '', properties = {}) => { if (name === 'variant') return { ...properties, description: <> <div><strong>Card variants</strong></div> <ul> <li><strong>product</strong> large card, lots of padding horizontally stacked</li> <li><strong>product-small</strong> small card for sidebars</li> <li><strong>info</strong> small card with sharp corners and no box-shadow</li> </ul> </> } } return () => { <Card maxWidth={950} mx="auto" my={2} px={0} py={2} bg="white"> <PropsTable component={Card} theme={theme} transformProps={transformProps} /> </Card> }
NameTypeDefaultDescriptionTheme values
id*string
opacitynumber, string, array, object
variantstring""
Card variants
  • product large card, lots of padding horizontally stacked
  • product-small small card for sidebars
  • info small card with sharp corners and no box-shadow
mnumber, string, array, objectmargin
[0,4,8,16,32,64]
mbnumber, string, array, objectmargin-bottom
[0,4,8,16,32,64]
mlnumber, string, array, objectmargin-left
[0,4,8,16,32,64]
mrnumber, string, array, objectmargin-right
[0,4,8,16,32,64]
mtnumber, string, array, objectmargin-top
[0,4,8,16,32,64]
mxnumber, string, array, objectpadding
[0,4,8,16,32,64]
mynumber, string, array, objectmargin-top & margin-bottom
[0,4,8,16,32,64]
pnumber, string, array, object2padding
[0,4,8,16,32,64]
pbnumber, string, array, objectpadding-bottom
[0,4,8,16,32,64]
plnumber, string, array, objectpadding-left
[0,4,8,16,32,64]
prnumber, string, array, objectpadding-right
[0,4,8,16,32,64]
ptnumber, string, array, objectpadding-top
[0,4,8,16,32,64]
pxnumber, string, array, objectpadding-left & padding-right
[0,4,8,16,32,64]
pynumber, string, array, objectpadding-top & padding-bottom
[0,4,8,16,32,64]
marginnumber, string, array, objectmargin
[0,4,8,16,32,64]
marginBottomnumber, string, array, objectmargin-bottom
[0,4,8,16,32,64]
marginLeftnumber, string, array, objectmargin-left
[0,4,8,16,32,64]
marginRightnumber, string, array, objectmargin-right
[0,4,8,16,32,64]
marginTopnumber, string, array, objectmargin-top
[0,4,8,16,32,64]
marginXnumber, string, array, objectmargin-left & margin-right
[0,4,8,16,32,64]
marginYnumber, string, array, objectmargin-top & margin-bottom
[0,4,8,16,32,64]
paddingnumber, string, array, objectpadding
[0,4,8,16,32,64]
paddingBottomnumber, string, array, objectpadding-bottom
[0,4,8,16,32,64]
paddingLeftnumber, string, array, objectpadding-left
[0,4,8,16,32,64]
paddingRightnumber, string, array, objectpadding-right
[0,4,8,16,32,64]
paddingTopnumber, string, array, objectpadding-top
[0,4,8,16,32,64]
paddingXnumber, string, array, objectpadding-left & padding-right
[0,4,8,16,32,64]
paddingYnumber, string, array, objectpadding-top & padding-bottom
[0,4,8,16,32,64]
backgroundColornumber, string, array, objectbackground-color
{"eggshell":"#f4f1de","terracotta":"#e07a5f","independence":"#3d405b","green":"#81b29a","champagne":"#f2cc8f","white":"#fff","black":"#000","link":"#3f51b5","grey":["rgb(50,50,50)","rgb(100,100,100)","rgb(150,150,150)","rgb(200,200,200)"]}
bgnumber, string, array, object"white"background-color
{"eggshell":"#f4f1de","terracotta":"#e07a5f","independence":"#3d405b","green":"#81b29a","champagne":"#f2cc8f","white":"#fff","black":"#000","link":"#3f51b5","grey":["rgb(50,50,50)","rgb(100,100,100)","rgb(150,150,150)","rgb(200,200,200)"]}
colornumber, string, array, objectcolor
{"eggshell":"#f4f1de","terracotta":"#e07a5f","independence":"#3d405b","green":"#81b29a","champagne":"#f2cc8f","white":"#fff","black":"#000","link":"#3f51b5","grey":["rgb(50,50,50)","rgb(100,100,100)","rgb(150,150,150)","rgb(200,200,200)"]}
displaynumber, string, array, objectdisplay
heightnumber, string, array, objectheight
[100,200,400,620,800,1200]
maxHeightnumber, string, array, objectmax-height
[100,200,400,620,800,1200]
maxWidthnumber, string, array, objectmax-width
[100,200,400,620,800,1200]
minHeightnumber, string, array, objectmin-height
[100,200,400,620,800,1200]
minWidthnumber, string, array, objectmin-width
[100,200,400,620,800,1200]
overflownumber, string, array, objectoverflow
overflowXnumber, string, array, objectoverflow-x
overflowYnumber, string, array, objectoverflow-y
sizenumber, string, array, objectwidth & height
[100,200,400,620,800,1200]
verticalAlignnumber, string, array, objectvetical-align
widthnumber, string, array, objectwidth
[100,200,400,620,800,1200]
bordernumber, string, array, objectborder
{}
borderBottomnumber, string, array, objectborder-bottom
{}
borderBottomColornumber, string, array, objectborder-bottom-color
{"eggshell":"#f4f1de","terracotta":"#e07a5f","independence":"#3d405b","green":"#81b29a","champagne":"#f2cc8f","white":"#fff","black":"#000","link":"#3f51b5","grey":["rgb(50,50,50)","rgb(100,100,100)","rgb(150,150,150)","rgb(200,200,200)"]}
borderBottomLeftRadiusnumber, string, array, objectborder-bottom-left-radius
["2px","4px","6px","12px"]
borderBottomRightRadiusnumber, string, array, objectborder-bottom-right-radius
["2px","4px","6px","12px"]
borderBottomStylenumber, string, array, objectborder-bottom-style
borderBottomWidthnumber, string, array, objectborder-bottom-width
["none","1px","2px"]
borderColornumber, string, array, objectborder-color
{"eggshell":"#f4f1de","terracotta":"#e07a5f","independence":"#3d405b","green":"#81b29a","champagne":"#f2cc8f","white":"#fff","black":"#000","link":"#3f51b5","grey":["rgb(50,50,50)","rgb(100,100,100)","rgb(150,150,150)","rgb(200,200,200)"]}
borderLeftnumber, string, array, objectborder-left
{}
borderLeftColornumber, string, array, objectborder-left-color
{"eggshell":"#f4f1de","terracotta":"#e07a5f","independence":"#3d405b","green":"#81b29a","champagne":"#f2cc8f","white":"#fff","black":"#000","link":"#3f51b5","grey":["rgb(50,50,50)","rgb(100,100,100)","rgb(150,150,150)","rgb(200,200,200)"]}
borderLeftStylenumber, string, array, objectborderLeftStyle
borderLeftWidthnumber, string, array, objectborder-left-width
["none","1px","2px"]
borderRadiusnumber, string, array, object2border-radius
["2px","4px","6px","12px"]
borderRightnumber, string, array, objectborder-right
{}
borderRightColornumber, string, array, objectborder-right-color
{"eggshell":"#f4f1de","terracotta":"#e07a5f","independence":"#3d405b","green":"#81b29a","champagne":"#f2cc8f","white":"#fff","black":"#000","link":"#3f51b5","grey":["rgb(50,50,50)","rgb(100,100,100)","rgb(150,150,150)","rgb(200,200,200)"]}
borderRightStylenumber, string, array, objectborder-right-style
borderRightWidthnumber, string, array, objectborder-right-width
["none","1px","2px"]
borderStylenumber, string, array, objectborder-style
borderTopnumber, string, array, objectborder-top
{}
borderTopColornumber, string, array, objectborder-top-color
{"eggshell":"#f4f1de","terracotta":"#e07a5f","independence":"#3d405b","green":"#81b29a","champagne":"#f2cc8f","white":"#fff","black":"#000","link":"#3f51b5","grey":["rgb(50,50,50)","rgb(100,100,100)","rgb(150,150,150)","rgb(200,200,200)"]}
borderTopLeftRadiusnumber, string, array, objectborder-top-left-radius
["2px","4px","6px","12px"]
borderTopRightRadiusnumber, string, array, objectborder-top-right-radius
["2px","4px","6px","12px"]
borderTopStylenumber, string, array, objectborder-top-style
borderTopWidthnumber, string, array, objectborder-top-width
["none","1px","2px"]
borderWidthnumber, string, array, objectborder-width
["none","1px","2px"]
borderXnumber, string, array, objectborder-right & border-left
{}
borderYnumber, string, array, objectborder-top & border-bottom
{}