1.3.20 • Published 8 months ago

alif-ui v1.3.20

Weekly downloads
-
License
ISC
Repository
github
Last release
8 months ago

Installation

npm install alif-ui
yarn add alif-ui

Usage

  • brand: This prop sets the brand for your application and should be one of the following options: 'alif', 'alifshop', or 'aliftech'.
  • initialMode: This prop sets the initial theme mode for your application and can be either 'light' or 'dark'. Note: You can easily change the mode with useMode hook provided by this library

To use the alif-ui components in your project, follow these steps:

For a Standard React Application

Wrap your application with the AlifProvider.

import { AlifProvider } from 'alif-ui';
import 'alif-ui/styles.css';

function App() {
	return (
		<AlifProvider brand="alif" initialMode="light">
			{/* Your application components */}
		</AlifProvider>
	);
}

export default App;

For a Next.js Application

To integrate AlifProvider into a Next.js application follow these steps:

1. Create a Client-Side Wrapper Component File: components/ClientProviderWrapper.tsx

'use client';

import { ReactNode } from 'react';
import { AlifProvider } from 'alif-ui';
import 'alif-ui/styles.css';

interface ClientProviderWrapperProps {
	children: ReactNode;
}

const ClientProviderWrapper = ({ children }: ClientProviderWrapperProps) => {
	return (
		<AlifProvider initialMode="light" brand="alif">
			{children}
		</AlifProvider>
	);
};

export default ClientProviderWrapper;

Using the App Router

2. Update the Root Layout File: app/layout.tsx

import { ReactNode } from 'react';
import ClientProviderWrapper from '../components/ClientProviderWrapper';

interface RootLayoutProps {
	children: ReactNode;
}

const RootLayout = ({ children }: RootLayoutProps) => {
	return (
		<html lang="en">
			<body>
				<ClientProviderWrapper>{children}</ClientProviderWrapper>
			</body>
		</html>
	);
};

export default RootLayout;

Using the Pages Router

2. Update the App Component file: pages/_app.tsx

import type { AppProps } from 'next/app';
import ClientProviderWrapper from '../components/ClientProviderWrapper';

export default function App({ Component, pageProps }: AppProps) {
	return (
		<ClientProviderWrapper>
			<Component {...pageProps} />
		</ClientProviderWrapper>
	);
}

Documentation

Visit https://ui.alif.tj to view the full documentation.

1.3.19

9 months ago

1.3.20

8 months ago

1.3.18

9 months ago

1.3.17

9 months ago

1.3.15

9 months ago

1.3.16

9 months ago

1.3.10

11 months ago

1.3.9

11 months ago

1.3.13

11 months ago

1.3.14

11 months ago

1.3.11

11 months ago

1.3.12

11 months ago

1.3.7

11 months ago

1.2.7

11 months ago

1.2.6

11 months ago

1.2.5

11 months ago

1.2.4

11 months ago

1.2.3

11 months ago

1.2.2

11 months ago

1.2.1

11 months ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago