idm-ui-package
v1.0.3
Published
This is an npm library for React that wraps and exports Material-UI (MUI) components, including Table, Button, Graph, Toast, and other basic UI elements. The project uses TypeScript, is built with tsup, and is ready for local testing and npm publishing.
Readme
npm publish
IDM UI Package Components
Button
Description: Material-UI Button wrapper. Supports all MUI Button props.
<Button variant="contained" color="primary">Click Me</Button>Table
Description: Material-UI DataGrid wrapper. Supports sorting, search, pagination.
Props:
columns: GridColDef[]— Table columns (MUI DataGrid columns)rows: any[]— Table datapageSizeOptions?: number[]— Pagination optionsinitialPageSize?: number— Initial page sizeautoHeight?: boolean— Auto height
Example:
<Table columns={columns} rows={rows} pageSizeOptions={[5,10,25]} />Toast
Description: Toast notifications using react-toastify.
Props:
- No props. Use
<Toast />andshowToast('message').
Example:
<Toast />
showToast('Hello World');Graph
Description: Line chart using recharts.
Props:
data: Array<Record<string, any>>— Chart dataxKey: string— X axis keylineKey: string— Line data keylineColor?: string— Line color
Example:
<Graph data={data} xKey="name" lineKey="value" />Input
Description: Material-UI TextField supporting all input types, label, placeholder, and icon.
Props:
- All MUI TextField props
type?: string— Input type (text, password, email, etc.)label?: string— Input labelplaceholder?: string— Input placeholdericon?: keyof typeof Icons— Icon name from MUI iconsiconPosition?: 'start' | 'end'— Icon positiononIconClick?: () => void— Icon click handler
Example:
<Input label="Name" placeholder="Enter name" />
<Input type="password" label="Password" />
<Input icon="Search" label="Search" />
<Input icon="Visibility" iconPosition="end" onIconClick={handler} />Dropdown
Description: Material-UI Select supporting single and multi-select.
Props:
label?: string— Dropdown labeloptions: { label: string; value: string }[]— Options listvalue: string | string[]— Selected value(s)multiple?: boolean— Enable multi-selectonChange: (value: string | string[]) => void— Change handler- All MUI Select props
Example:
<Dropdown label="Select" options={[{label: 'A', value: 'a'}]} value="a" onChange={handler} />
<Dropdown label="Multi" options={[{label: 'A', value: 'a'}]} value={["a"]} multiple onChange={handler} />Icons
Description:
All MUI icons exported as Icons.
Example:
<Icons.Search />
<Icons.Visibility />Theme
Description: Material-UI theme wrapper.
Props:
children: React.ReactNode
Example:
<ThemeWrapper>
<Button>Click Me</Button>
</ThemeWrapper>Testing
Run tests with:
npm testPublishing
npm publishLicense
MIT
