Getting-Started

Usage

Learn how to effectively use the components and features of AueraUI to build your UI with ease.

Logo

Basic Usage

After installation, you can import any AueraUI component and start playing around. For example, try changing the variant on the Button

Globals

Since AueraUI is built to function globally, you can control the look and behavior of your app using the Provider and hooks.

Theme

AueraUI allows you to customize the look and feel of your application with its flexible theming system. The ThemeProvider component enables global theme management, allowing you to apply consistent styling across your app.

Default Theme

By default, AueraUI detects the user's system theme and applies the appropriate theme. This provides a seamless experience for users, as the UI will automatically align with their system settings.

ToggleTheme

AueraUI provides a toggle function that allows you to manually switch between the user's system theme and AueraUI's theme set. The toggle function has two main options:

  • toggleTheme.system: Switches to the user's system theme based on the user's operating system settings.

  • toggleTheme.main: Switches to AueraUI's predefined theme set,

This toggleTheme functionality is useful when you want to give users the ability to manually switch between system preferences and the app's theme.

Example Usage:

App.tsx

import { useTheme, Button } from 'auera-ui';
export default function App() {
const { toggleTheme } = useTheme();
return (
<div>
<Button onClick={() => toggleTheme.system()}>Use System Theme</Button>
<Button onClick={() => toggleTheme.main()}>Use AueraUI Theme</Button>
</div>
);
}

Overlays

To maintain better organization, keep all overlay components (e.g., Modal, Drawer) in an overlays folder.

1

Overlay Component

Below is an example of how you should structure your overlays.

components/overlays/auth.tsx

import { Modal, ModalPanel, ModalContent, ModalHeader, IconButton } from "auera-ui";
import { IoClose } from "react-icons/io5";
const AuthModal = () => {
// Your logic here
return (
<Modal value="auth-modal">
<ModalPanel>
<ModalHeader>
<h1>Sign in</h1>
<IconButton
withTrigger
trigger="modal"
triggerType="close"
triggerValue="auth-modal"
variant="ghost"
>
<IoClose size={18} />
</IconButton>
</ModalHeader>
<ModalContent>{/* Add your modal content here */}</ModalContent>
</ModalPanel>
</Modal>
);
};
export default AuthModal;

2

Create File

Create a single file, such as overlays/container.js or overlays/container.tsx, and import all the overlay components into it.

components/overlays/container.tsx

import AuthModal from "./auth";
import MenuDrawer from "./menu";
const Overlays = () => {
return (
<>
<AuthModal />
<MenuDrawer />
{/* Add more overlays as needed */}
</>
);
};
export default Overlays;

3

Import Components

Import the newly created Overlays Component from overlays/container.tsx into your root layout or App.tsx.

layout.tsx

import Overlays from "../components/overlays/container";
const RootLayout = () => {
return (
<>
{/* Other components */}
<Overlays />
</>
);
};
export default RootLayout;

This approach simplifies imports and centralizes overlay management.