./packages/components/srcindex.js; see exports belowREADME.mdxindex.js.
└── packages
    └── components
        └── src
            ├── index.js
            ├── README.mdx
            ├── otherInternalOnlyFunctionality.js
            └── SpacedGroup.js
The component directory's index.js file export the publicly consumable portions of the component. In other words, it should never be required to import from a file within the component's directory other than the index.js file.
Component directories should always export all items as named exports.
index.jsexport { default as MainComponent } from './MainComponent';
export { default as SecondaryComponent } from './SecondaryComponent';
Occassionally there will be a group of components that work together and are only relevant when used with each other (example: a list and list items). In these cases, ensure the primary component is a named export. Prefix secondary components with primary component name. As an example, in the case of List:
export { List } from './List';
export { default as ListItem } from './Item';
export { default as ListItemText } from './ItemText';
Component styling is powered by our implementation using fela.
createComponent function to create styled components (see StyleProvider component)See createComponent and ThemeProvider for more a more in-depth explanation.
StyleProvider and createComponent Exampleconst Button = createComponent(
  () => ({
    color: 'blue',
  }),
  'div',
);
const SaveButton = ({ children }) => <Button>{children}</Button>;
propTypes and also comments on each propTypedefaultPropsconst MyComponent = ({text}) => <span>Hello {text}.</span>;
MyComponent.propTypes = {
  /** Inner text */
  text: PropTypes.color,
};
MyComponent.defaultProps: {
  text: 'world',
};
Not all components are theme-enabled; however, those that are should declare a ThemeDefinition and defaultThemeValues.
See createComponent and ThemeProvider for more details on how to consume the theme in your component.
themeDefintion and also comment descriptions for each value; similar to propTypes, but describes the theme-able configuration properites of the componentdefaultThemeValuesconst MyComponent = () => <span>Hello World</span>;
MyComponent.themeDefintion = {
  /** Text color */
  color: PropTypes.color,
};
MyComponent.defaultThemeValues: {
  color: 'lightgray',
};