Practical React components, hooks, and utilities built around Ant Design.
@tiny-codes/react-easy is a TypeScript React library that packages:
- Ant Design oriented UI components for common product workflows
- reusable hooks for state, validation, communication, and interaction
- utility helpers for browser and Node-friendly data handling
Demo: https://shijistar.github.io/react-easy
The library is published as:
- CommonJS:
lib/ - ESM:
es/ - types:
lib/index.d.ts
Shipped JavaScript target: ES2016
- Global
ConfigProviderwith localization support and shared defaults - confirm / delete-confirm / modal action abstractions for repetitive dialogs
- form-oriented helpers such as
withModalAction,EditableText, and validation hooks - table and layout helpers such as
ColumnSetting,OverflowTags, andFloatDrawer - communication hooks such as
useSSEanduseStompSocket - browser-friendly helpers for
base64, crypto, strings, streams, and math
Install the package and required peer dependencies:
npm install @tiny-codes/react-easy react react-is antd i18nextOr with other package managers:
pnpm add @tiny-codes/react-easy react react-is antd i18nextyarn add @tiny-codes/react-easy react react-is antd i18nextbun add @tiny-codes/react-easy react react-is antd i18nextreact>= 16.8.0react-is>= 16.8.0antd>= 5.1.0i18next>= 8.4.0
Notes:
- Peer dependencies must be installed by the consuming app.
- Output code targets
ES2016, so your bundler/runtime should support it.
Click https://shijistar.github.io/react-easy to see all features in action.
import { ConfigProvider } from '@tiny-codes/react-easy';
import { useTranslation } from 'react-i18next';
function Root() {
const { t, i18n } = useTranslation();
return (
<ConfigProvider
lang={i18n.language}
localize={t}
defaultConfirmTitle="common.confirm"
defaultConfirmContent="common.confirm.content"
defaultDeletionConfirmTitle="common.deleteConfirm"
defaultDeletionConfirmContent="common.deleteConfirm.content"
>
<App />
</ConfigProvider>
);
}import { ConfirmAction, DeleteConfirmAction } from '@tiny-codes/react-easy';
function DangerZone() {
return (
<>
<ConfirmAction.Button onOk={() => console.log('confirmed')}>Enable feature</ConfirmAction.Button>
<DeleteConfirmAction.Button onOk={() => console.log('deleted')}>Delete item</DeleteConfirmAction.Button>
</>
);
}import { type FormCompPropsConstraint, withModalAction } from '@tiny-codes/react-easy';
import { Form, Input } from 'antd';
type User = { name: string };
type UserFormProps = { data?: User };
function UserForm(props: UserFormProps & FormCompPropsConstraint<User>) {
const { form, data, onSave } = props;
onSave(async (values) => {
await api.save(values);
});
return (
<Form form={form} initialValues={data}>
<Form.Item name="name" label="Name">
<Input />
</Form.Item>
</Form>
);
}
const UserModalAction = withModalAction(UserForm);import { useRefFunction, useValidators } from '@tiny-codes/react-easy';
import { Form, Input } from 'antd';
function Demo() {
const { email, codeMax20 } = useValidators();
const handleSubmit = useRefFunction(() => {
console.log('stable callback');
});
return (
<Form onFinish={handleSubmit}>
<Form.Item name="email" rules={[{ validator: email }]}>
<Input />
</Form.Item>
<Form.Item name="code" rules={[codeMax20]}>
<Input />
</Form.Item>
</Form>
);
}BreakLinesColumnSettingConfigProviderConfirmActionContextMenuDeleteConfirmActionEditableTextEllipsisParagraphEllipsisTextEllipsisTitleEllipsisLinkFloatDrawerFormItemControlIconfontLoadingModalActionOverflowTagsPulseAnimation
useAudioPlayeruseDebounceuseLocalStorageuseMovableuseProcessingTextuseRefFunctionuseRefValueuseRowSelectionuseSplitteruseSSEuseStompSocketuseUserMediauseValidatorsuseValidatoruseValidatorBuilder
AudioPlayerbase64colorcryptomathstreamstring
Install dependencies:
npm installCommon commands:
npm run build
npm run build-core
npm run storybook
npm run build-storybook
npx tsc -p tsconfig.json --noEmit
npx eslint src .storybook scripts --ext .ts,.tsx,.js,.jsx
npx prettier . --checkNotes for contributors:
- Source code lives in
src/. lib/andes/are generated outputs.- Storybook is the main local playground for components and docs.
- Jest is installed, but this repository may not always contain committed test files/config.