-
Initialize the project with
React,Typescript,lessandantd@4.18in the way you want. You can simply use:npm create vite my-project-name -- --template react-ts cd my-project-name npm install react@17 react-dom@17 @kaspersky/hexa-ui-icons @kaspersky/hexa-ui --legacy-peer-deps npm install -D @types/react@17 @types/react-dom@17 less antd@4.18 --legacy-peer-deps -
Add this to
vite.config.tsfor correctlesswork:css: { preprocessorOptions: { less: { math: "always", relativeUrls: true, javascriptEnabled: true }, }, }
-
Add important
antdcss imports in root CSS file (index.css in that case):@import "antd/lib/style/themes/default.less"; @import "antd/dist/antd.less";
-
Define initial rendering in main.tsx:
import React from 'react' import ReactDOM from 'react-dom' import App from './App.tsx' import './index.css' const container = document.getElementById('root')! ReactDOM.render( <React.StrictMode> <App /> </React.StrictMode>, container )
-
Wrap your root layout component (for ex.: App.tsx) by the
ConfigProvider, addGlobalStylesandNotificationservice:import { useState } from 'react' import { ConfigProvider } from '@kaspersky/hexa-ui/design-system/context/provider' import { GlobalStyle } from '@kaspersky/hexa-ui/design-system/global-style' import { ThemeKey } from '@kaspersky/hexa-ui/design-system' import { LangVariants } from '@kaspersky/hexa-ui/helpers/localization/types' import { Notification, H1 } from '@kaspersky/hexa-ui' function App() { const [themeKey] = useState<ThemeKey>(ThemeKey.Light) return ( <ConfigProvider theme={themeKey} locale={LangVariants.EnUs}> <GlobalStyle /> <Notification/> <H1>Hi there! I am using @kaspersky/hexa-ui!</H1> </ConfigProvider> ) } export default App
-
Run with
npm run dev
quick-start
Directory actions
More options
Directory actions
More options
quick-start
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
parent directory.. | ||||