A React advanced components library based on TypeScript & Bootstrap, built by idea2app remote developers team.
- API document: https://idea2app.github.io/Idea-React/
| SemVer | status | ES decorator | MobX | Bootstrap |
|---|---|---|---|---|
>=3 |
✅developing | stage-3 | >=6.11 |
v6 |
>=2 <3 |
❌deprecated | stage-3 | >=6.11 |
v5 |
<2 |
❌deprecated | stage-2 | >=4 <6.11 |
v5 |
- Accordion
- Alert
- Avatar
- Badge
- Breadcrumb
- Button
- Button Group
- Card
- Carousel
- Close Button
- Collapse
- Dialog
- Drawer
- List Group
- Menu
- Nav
- Nav Overflow
- Navbar
- Pagination
- Placeholder
- Popover
- Progress
- Scrollspy
- Spinner
- Stepper
- Tab
- Toast
- Toggler
- Tooltip
- Toggle Button
- Form, Fieldset, Field, Group, Field Content & Label
- Form Control, Text Area & Select
- Checkbox
- Radio & Form Check
- Switch
- Range
- Input Group
- Floating Label
- Form Adornment & Ghost
- Chip
- Chip Input
- Combobox
- Date Picker
- OTP Input
- Password Strength
- Form Feedback & Text
- Click Boundary
- Code Block
- Countdown
- DialogBox
- Markdown View
- Horizontal Marquee
- Icon
- Live TSX
- Loading
- Month Calendar
- Nameplate
- Overlay Box
- Page Nav
- Scroll Nav
- Share Box
- Spinner Button
- Table Spinner
- Text Truncate
- Time
- Time Distance
- Timeline
- Type Echo
- User Rank
- Vertical Marquee
- Zodiac Bar
Table, List & Form components around Data models, have been migrated to https://github.com/idea2app/MobX-RESTful-table, since Idea-React v1.0.0.
Open Map component & model, have been migrated to https://github.com/idea2app/OpenReactMap, since Idea-React v1.0.0.
npm install idea-react mobx mobx-react react react-dom react-element-to-jsx-string web-utilityFor the current alpha release, use idea-react@next instead of idea-react.
<link
rel="stylesheet"
href="https://unpkg.com/bootstrap@6.0.0-alpha.1/dist/css/bootstrap.min.css"
/>
<link rel="stylesheet" href="https://unpkg.com/bootstrap-icons@1.13.2/font/bootstrap-icons.css" />
<link rel="stylesheet" href="https://unpkg.com/animate.css@4.1.1/animate.min.css" />
<link rel="stylesheet" href="https://unpkg.com/github-markdown-css@5.9.0/github-markdown.css" />
<link rel="stylesheet" href="https://unpkg.com/idea-react/dist/style.css" />Compatible with MobX 6/7:
{
"compilerOptions": {
"target": "ES6",
"moduleResolution": "Node",
"useDefineForClassFields": true,
"experimentalDecorators": false,
"jsx": "react-jsx"
}
}Components with a single root support as, accepting an HTML tag or another React component:
import { ComponentPropsWithRef, FC } from 'react';
import { Button, Card, PolymorphicProps } from 'idea-react';
const RouterLink: FC<ComponentPropsWithRef<'a'> & { to: string }> = ({ to, ...props }) => (
<a {...props} href={to} />
);
type LinkCardProps = PolymorphicProps<typeof RouterLink, { theme?: 'primary' }>;
<Card as="article">Article content</Card>;
<Button as={RouterLink} to="/docs" variant="solid" theme="primary">
Documentation
</Button>;The target's additional props are inferred and forwarded, including required props and compatible
refs. Component-specific props keep their existing meaning and take precedence on name collisions.
Without as, the default markup and props stay unchanged. Class component refs still refer to the
component instance. Behavioral components require compatible root elements; custom roots must forward
their DOM props and refs. Components that render fragments or multiple roots do not support as.
import { formToJSON } from 'web-utility';
import { Component, FormEvent } from 'react';
import {
Button,
Dialog,
DialogBody,
DialogBox,
DialogBoxClose,
DialogFooter,
DialogHeader,
DialogTitle,
Form,
FormControl,
FormField,
FormLabel
} from 'idea-react';
export class ExamplePage extends Component {
inputDialog = new DialogBox<{}, Record<'a' | 'b', number>>(({ defer }) => (
<Dialog open={!!defer} onClose={() => defer?.reject(new DialogBoxClose())}>
<DialogHeader>
<DialogTitle>Dialog</DialogTitle>
</DialogHeader>
<DialogBody>
<Form
className="d-flex flex-column gap-3"
id="input-dialog"
onSubmit={this.handleSubmit}
onReset={() => defer?.reject(new DialogBoxClose())}
>
<FormField>
<FormLabel htmlFor="input-dialog-a">A</FormLabel>
<FormControl id="input-dialog-a" type="number" name="a" />
</FormField>
<FormField>
<FormLabel htmlFor="input-dialog-b">B</FormLabel>
<FormControl id="input-dialog-b" type="number" name="b" />
</FormField>
</Form>
</DialogBody>
<DialogFooter>
<Button form="input-dialog" type="submit" variant="solid" theme="primary">
√
</Button>
<Button form="input-dialog" type="reset" variant="solid" theme="danger">
×
</Button>
</DialogFooter>
</Dialog>
));
handleSubmit = (event: FormEvent<HTMLFormElement>) => {
event.preventDefault();
const data = formToJSON<Record<'a' | 'b', number>>(event.currentTarget);
this.inputDialog.defer?.resolve(data);
};
someLogic = async () => {
try {
const data = await this.inputDialog.open();
alert(JSON.stringify(data, null, 4));
} catch (error) {
if (error instanceof DialogBoxClose) console.warn(error.message);
}
};
render() {
return (
<>
<Button onClick={this.someLogic}>Open dialog</Button>
<this.inputDialog.Component />
</>
);
}
}import { Component } from 'react';
import { Button, Toast } from 'idea-react';
export class ExamplePage extends Component {
toast = new Toast();
render() {
return (
<>
<Button
onClick={() =>
this.toast
.open({
title: 'Notification',
body: 'Hello, world!',
theme: 'success'
})
.then(() => console.log('Toast closed'))
}
>
Show Toast
</Button>
<this.toast.Component />
</>
);
}
}The document workspace provides a static website with MDX pages, theme switching, and local search, adapting the upstream website to Idea React.
pnpm install
pnpm --filter @idea-react/document devFor build and deployment quick start, see the document workspace guide above. Contributor conventions, validation, and release instructions are in AGENTS.md.
