yarn set version classic
<RhThemeProvider theme='light'> --- You App --- </RhThemeProvider>
Import components you want into your UI
import { RhButton } from '@rhythm/react';
and use them like so
const example = () => ( <div> <RhButton variant="primary" onClick={() => {}}>Do something</RhButton> </div> )
The complete library is made using lerna and lerna workspace
We are using yarn as a package manager in the project
The complete library is ESM module, which means they are treeshakable by default
We have 2 workspaces inside the library one actual component library and a kitchensink app to demonstrate the whole components
Rhythm UI - It is a UI component library developed using React JS which helps developers to build an awesome react website without worrying about component design creation.
Kitchensink Application - Kitchensink Application is made with Rhythm UI components to showcase the use of the Rhythm UI library.
Kitchen sink app is built using nextjs
We are using the storybook to demonstrate the components and the documentation
This component library is right now not compatible with CRA(create-react-app), try to use vite build/react starter kit that is provided by Codemonk
why CRA is not supported: GitHub issue
We are using rollup as a bundler for bundling the component library and we are using the ESM build
.stories.js
import React from 'react' import RhLabel from './Label' export default { title: 'Label', component: RhLabel, parameters: { argTypes: { contain: { control: 'boolean', }, aspectRadio: { options: ['auto', 'video', 'square'], control: { type: 'select' }, }, }, docs: { page: () => ( <> <Title /> <Subtitle /> <Description /> <Primary /> <ArgsTable story={PRIMARY_STORY} /> <Stories /> </> ), }, }; const inputID='label-for-input' const Template = (args) => <RhLabel {...args} /> export const Default = Template.bind({}); Default.args = { label: 'Input Label', labelFor:inputID, } export const Required = Template.bind({}) Required.args={ ...Default.args, isRequired:true, } export const InfoLabel = Template.bind({}) InfoLabel.args={ ...Required.args, haveInfoBtn:true, infoBtnText:'Info here' } export const errorLabel = Template.bind({}) errorLabel.args={ ...InfoLabel.args, isError:true, }
.tsx
import React from 'react' interface RhLabelProps { label:string labelFor?:string isRequired:boolean haveInfoBtn?:boolean infoBtnText?:string isError:boolean } const RhLabel=(props: RhLabelProps)=> { const {label,labelFor,isRequired,haveInfoBtn,isError,infoBtnText}=props return (<div></div>) } RhLabel.defaultProps={ isRequired:false, haveInfoBtn:false, isError:false } export default RhLabel