You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A simple, lightweight design system for React applications.
Installation
npm i @saul-atomrigs/design-system
Usage
Box
import{Box}from'@saul-atomrigs/design-system';functionApp(){return(<Boxbg='#f5f5f5'padding='2rem'align='center'>
This is a simple box with custom background and padding
</Box>);}
Props
Prop
Type
Default
Description
children
ReactNode
required
Content to display inside the box
bg
string
"white"
Background color
padding
string
"1rem"
Padding value (CSS value)
align
'center' | 'left' | 'right'
"left"
Text alignment
onClick
() => void
undefined
Click handler function
onMouseOver
() => void
undefined
Mouse over handler function
onMouseOut
() => void
undefined
Mouse out handler function
style
CSSProperties
{}
Additional CSS styles
Button
import{Button}from'@saul-atomrigs/design-system';functionApp(){return(<Buttonvariant='primary'onClick={()=>alert('Button clicked!')}>
Click me
</Button>);}
Exactly two children elements to be displayed side by side
Error
import{Error}from'@saul-atomrigs/design-system';functionApp(){return<Errormessage='Failed to load data'/>;}
Props
Prop
Type
Default
Description
message
string
"Something went wrong"
Error message to display
children
ReactNode
undefined
Alternative content for the error
IntersectionObserver
A wrapper component designed for implementing features like infinite scrolling or lazy loading. It wraps the browser's IntersectionObserver API, allowing you to trigger specific actions when an element enters the viewport.
The Modal component can be used in two ways: as a standard component or using compound components pattern.
Standard Usage
import{Modal}from'@saul-atomrigs/design-system';functionApp(){const[isOpen,setIsOpen]=useState(false);return(<><buttononClick={()=>setIsOpen(true)}>Open Modal</button><ModalisOpen={isOpen}onClose={()=>setIsOpen(false)}title='Example Modal'><p>This is the modal content</p><buttononClick={()=>setIsOpen(false)}>Close</button></Modal></>);}
Compound Components Pattern
import{Modal}from'@saul-atomrigs/design-system';functionApp(){return(<Modal.Providertitle='Example Modal'><Modal.Trigger><button>Open Modal</button></Modal.Trigger><Modal.Content><p>This is the modal content</p><Modal.CTAButton>Confirm</Modal.CTAButton></Modal.Content></Modal.Provider>);}
Props
Modal Component
Prop
Type
Default
Description
isOpen
boolean
required
Controls whether the modal is visible
onClose
() => void
required
Function called when modal should close
title
string
undefined
Title displayed in the modal header
children
ReactNode
required
Content to display inside the modal
trigger
ReactNode
undefined
Optional element that opens the modal
Modal.Provider
Prop
Type
Default
Description
children
ReactNode
required
The Modal components to be contextualized
defaultOpen
boolean
false
Whether modal starts open or closed
title
string
undefined
Title displayed in the modal header
Modal.Trigger
Prop
Type
Default
Description
children
ReactNode
required
Element that will trigger the modal to open
disabled
boolean
false
Whether the trigger is disabled
Modal.Content
Prop
Type
Default
Description
children
ReactNode
required
Content to display inside the modal
Modal.CTAButton
Prop
Type
Default
Description
children
ReactNode
required
Button label
onClick
() => void
undefined
Additional click handler function
disabled
boolean
false
Whether button is disabled
Tabs
A compound component for creating tabbed interfaces.
import{Tabs}from'@saul-atomrigs/design-system';functionApp(){consttabConfig=[{label: 'Tab 1',content: <div>Content for tab 1</div>},{label: 'Tab 2',content: <div>Content for tab 2</div>},{label: 'Tab 3',content: <div>Content for tab 3</div>},];return(<Tabstabs={tabConfig}><Tabs.Trigger/><Tabs.Content/></Tabs>);}
Props
Tabs Component
Prop
Type
Default
Description
tabs
{ label: string; content: React.ReactNode }[]
required
Configuration for tabs
children
ReactNode
required
Tabs.Trigger and Tabs.Content components
Tabs.Trigger and Tabs.Content
These components don't require props as they consume the context provided by the parent Tabs component.
TextInput
A customizable input component with support for various input types including money formatting.
import{TextInput}from'@saul-atomrigs/design-system';functionApp(){const[value,setValue]=useState('');return(<TextInputname='username'value={value}onChange={(e)=>setValue(e.target.value)}placeholder='Enter your username'type='text'/>);}