1.0.9 • Published 5 months ago
@cognam/shared-project v1.0.9
Shared Components Library - @cognam/shared-project
A collection of reusable React components built with Material-UI. This package helps maintain consistency across your React projects by centralizing commonly used UI components.
📦 Installation
npm install @cognam/shared-project🚀 Usage
You can import individual components like this:
import { AppButton, CustomInput } from '@cognam/shared-project';Or import all components at once:
import * as SharedComponents from '@cognam/shared-project';🧩 Available Components
✅ AppButton
A Material-UI Button wrapper with consistent styling.
Props:
size:'small' | 'medium' | 'large'style:React.CSSPropertiesvariant:'text' | 'outlined' | 'contained'className:stringcolor:'primary' | 'secondary' | 'error' | 'info' | 'success' | 'warning'disabled:booleanonClick:functionchildren:React.ReactNode
🧱 BtnContainer
A container component to group and align buttons (typically right-aligned).
Props:
className:stringstyle:React.CSSPropertieschildren:React.ReactNode
🔘 CustomCheckBox
A styled Material-UI Checkbox with an optional label.
Props:
checked:booleanonChange:functionname:stringdisabled:booleanlabel:stringclassName:string
📝 CustomInput
An enhanced Material-UI TextField with optional input masking and rich configuration.
Props:
testId:stringtype:stringname:stringvalue:string | numberonChange:functiononBlur:functionstartAdornment:React.ReactNodeendAdornment:React.ReactNodelabel:stringvariant:'standard' | 'outlined' | 'filled'error:booleanerrorText:stringhelperText:stringmask:string(requiresreact-input-mask)inputRef:React.Refmultiline:booleanrows:numberautoFocus:booleandisabled:booleanselect:booleanstyle:React.CSSPropertiesmaxLength:numberhelper:booleanplaceholder:stringisNegative:booleanautoComplete:string
📝 SnackBar
import { SnackBar } from '@cognam/shared-project';
// In your root component
<SnackBar />
// To show a snackbar from anywhere in your app:
import { showErrorMessage } from '@cognam/shared-project';
// Dispatch the action (requires Redux setup)
dispatch(showErrorMessage("Your message", "200", 200));
## 🔗 License
MIT — Feel free to use and contribute.