### Vite React Dark Mode Setup
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/getting-started/dark-mode/DarkMode.mdx
This snippet demonstrates the integration of a dark mode component within a Vite-based React project. It assumes the existence of a `DarkModeStepForReact` component which handles the specific setup logic for Vite environments.
```jsx
import React from 'react';
import DarkModeStepForReact from './DarkModeStepForReact';
function ViteReactApp() {
return (
Vite React App
Setting up dark mode in vite React Project.
);
}
```
--------------------------------
### Setup Toast Component
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/toast/Toast.mdx
Setup the Toast component by importing ToastWrapper and using the component. Paste the default toast variant from the documentation.
```javascript
import { ToastWrapper } from './variant/DefaultToast'
// In your root directory:
```
--------------------------------
### Default Steps Setup
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/steps/Step.mdx
Showcases the basic setup and usage of the Steps Component for a default configuration.
```javascript
import { DefaultSteps, DefaultStepsCode } from './variant/DefaultSteps'
import CodeHighlightPreview from '../../../components/CodeHighlightPreview'
// ... inside a React component
```
--------------------------------
### Install Keep React in Vite App
Source: https://github.com/staticmania/keep-react/blob/main/README.md
Steps to install Keep React and its dependencies in a Vite React application. This includes creating the Vite app, installing Tailwind CSS, and adding the keep-react and phosphor-react packages.
```bash
Step 1: Create a Vite React Application
```console
npm create vite@latest my-project -- --template react
cd my-project
```
Step 2: Install Tailwind CSS
```console
npm i autoprefixer postcss tailwindcss
npx tailwindcss init -p
```
Step 3: Install Keep React
```console
npm i keep-react phosphor-react
```
Or with Yarn
```console
yarn add keep-react phosphor-react
```
Or with Pnpm
```console
pnpm add keep-react phosphor-react
```
```
--------------------------------
### Next.js Dark Mode Setup
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/getting-started/dark-mode/DarkMode.mdx
This snippet illustrates how to set up dark mode in a Next.js application. It utilizes a dedicated `DarkModeStepForNext` component to manage the specific configurations required for Next.js projects.
```jsx
import React from 'react';
import DarkModeStepForNext from './DarkModeStepForNext';
function NextJsApp() {
return (
Next.js App
Setting up dark mode in NextJs Project.
);
}
```
--------------------------------
### Default Tooltip Example
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/tooltip/tooltip.mdx
Demonstrates the basic usage of the Default Tooltip component to display additional information on hover.
```javascript
import React from 'react';
import { DefaultTooltip, DefaultTooltipCode } from './variant/DefaultTooltip';
function App() {
return (
);
}
export default App;
```
--------------------------------
### Install Keep React in Next.js App
Source: https://github.com/staticmania/keep-react/blob/main/README.md
Steps to install Keep React and its dependencies in a Next.js application. This includes creating the Next.js app (ensuring Tailwind CSS is selected) and adding the keep-react and phosphor-react packages.
```bash
Step 1: Install Next Js Application
```console
npx create-next-app@latest
```
Ensure that you select `tailwindcss` as a dependency for your application during the setup.
`Would you like to use Tailwind CSS? -- Yes`
Step 2: Install Keep React
```console
npm i keep-react phosphor-react
```
Or with Yarn
```console
yarn add keep-react phosphor-react
```
Or with Pnpm
```console
pnpm add keep-react phosphor-react
```
```
--------------------------------
### Default Pagination Example
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/pagination/Pagination.mdx
Demonstrates the basic usage of the Pagination component, displaying a standard list of page numbers for navigation.
```javascript
import { DefaultPagination, DefaultPaginationCode } from './variant/DefaultPagination'
// Usage:
```
--------------------------------
### Recharts Installation
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/lineChart/LineChart.mdx
Installs the Recharts library, which is a dependency for the Line Chart component. This command should be run in your project's terminal.
```bash
npm install recharts
# or
yarn add recharts
```
--------------------------------
### Tooltip Instantly Open Example
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/tooltip/tooltip.mdx
Demonstrates how to control the delay duration for a tooltip to open using the 'delayDuration' prop.
```javascript
import React from 'react';
import { TooltipInstantlyOpen, TooltipInstantlyOpenCode } from './variant/TooltipInstantlyOpen';
function App() {
return (
);
}
export default App;
```
--------------------------------
### Recharts Installation for Area Chart
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/areaChart/AreaChart.mdx
Instructions for installing the Recharts library, which is a dependency for the Area Chart component. This step is crucial before using the chart.
```javascript
import { rechartsInstall } from './variant/Installation'
// ...
```
--------------------------------
### Drawer Positioning Example (React)
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/drawer/Drawer.mdx
Illustrates how to position the Drawer component from different directions such as left, right, top, or bottom. This example showcases the flexibility in controlling the drawer's entry point and display.
```javascript
import { DrawerPosition, DrawerPositionCode } from './variant/DrawerPosition'
import React from 'react';
// Example usage:
function App() {
return (
);
}
export default App;
```
--------------------------------
### Navbar Layout 3 Example
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/navbar/Navbar.mdx
Illustrates the third layout variation for the Navbar component. This example provides a distinct visual style and the corresponding code for its implementation.
```jsx
import React from 'react';
const NavbarLayout3 = () => {
return (
);
};
const NavbarLayout3Code = `import React from 'react';
const NavbarLayout3 = () => {
return (
);
};
`;
export { NavbarLayout3, NavbarLayout3Code };
```
--------------------------------
### Navbar Layout 2 Example
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/navbar/Navbar.mdx
Presents the second layout variant of the Navbar component. This example showcases a different design for the navigation bar, including its code for implementation.
```jsx
import React from 'react';
const NavbarLayout2 = () => {
return (
);
};
const NavbarLayout2Code = `import React from 'react';
const NavbarLayout2 = () => {
return (
);
};
`;
export { NavbarLayout2, NavbarLayout2Code };
```
--------------------------------
### Basic Keep React Component Usage
Source: https://github.com/staticmania/keep-react/blob/main/README.md
A simple example demonstrating how to import and use a `Button` component from the `keep-react` library within a React application.
```jsx
import { Button } from 'keep-react'
const App = () => {
return
}
export default App
```
--------------------------------
### Tooltip Placement Example
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/tooltip/tooltip.mdx
Illustrates how to control the placement of a tooltip using the 'side' prop, which accepts values like 'top', 'bottom', 'left', and 'right'.
```javascript
import React from 'react';
import { TooltipPlacement, TooltipPlacementCode } from './variant/TooltipPlacement';
function App() {
return (
);
}
export default App;
```
--------------------------------
### Install Recharts for Keep React Pie Charts
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/pieChart/PieChart.mdx
Instructions to install the Recharts library, a necessary dependency for the Keep React Pie Chart component. This step ensures all chart functionalities can be utilized correctly.
```javascript
npm install recharts
// or
yarn add recharts
```
--------------------------------
### Default Dropdown Example
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/dropdown/Dropdown.mdx
Demonstrates the basic usage of the Dropdown component, displaying a list of items with `` components. It's designed for simple selection scenarios.
```javascript
import React from 'react';
import { DefaultDropdown, DefaultDropdownCode } from './variant/DefaultDropdown';
function App() {
return (
);
}
```
--------------------------------
### Implement Default Popover in React
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/popover/popover.mdx
Demonstrates a basic popover component implementation using React. This example showcases the fundamental structure and usage of the Popover component.
```React
import { Popover, PopoverContent, PopoverTrigger } from '@radix-ui/react-popover'
export function DefaultPopover() {
return (
Open
I am a popover!
)
}
export const DefaultPopoverCode = `import { Popover, PopoverContent, PopoverTrigger } from '@radix-ui/react-popover'\n\nexport function DefaultPopover() {\n return (\n \n Open\n \n I am a popover!\n \n \n )\n}\n`
```
--------------------------------
### Navbar Layout 1 Example
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/navbar/Navbar.mdx
Demonstrates the first layout variant of the Navbar component. It includes a preview of the component and its associated code, typically used for navigation at the top of a webpage.
```jsx
import React from 'react';
const NavbarLayout1 = () => {
return (
);
};
const NavbarLayout1Code = `import React from 'react';
const NavbarLayout1 = () => {
return (
);
};
`;
export { NavbarLayout1, NavbarLayout1Code };
```
--------------------------------
### Navbar Layout 4 Example
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/navbar/Navbar.mdx
Showcases the fourth layout variant of the Navbar component. This example offers another design perspective for navigation elements, complete with its source code.
```jsx
import React from 'react';
const NavbarLayout4 = () => {
return (
);
};
const NavbarLayout4Code = `import React from 'react';
const NavbarLayout4 = () => {
return (
);
};
`;
export { NavbarLayout4, NavbarLayout4Code };
```
--------------------------------
### Default Area Chart Example
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/areaChart/AreaChart.mdx
Demonstrates the basic implementation of an Area Chart for simple data visualization. It shows the fundamental structure and rendering.
```jsx
import { DefaultAreaChart, DefaultAreaChartCode } from './variant/DefaultAreaChart'
// ...
```
--------------------------------
### Textarea With Helper Text (React)
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/textArea/TextArea.mdx
Displays the textarea component with an associated label and helper text to guide user input. Enhances usability by providing context.
```jsx
import React from 'react';
import { TextAreaWithHelperText } from './variant/TextAreaWithHelperText';
const App = () => {
return (
);
};
export default App;
```
--------------------------------
### Default Notification Example
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/notification/notification.mdx
Demonstrates the basic usage of the Default Notification component to display informative messages or alerts to users.
```javascript
import React from 'react';
import { DefaultNotification } from './variant/DefaultNotification';
const App = () => {
return (
);
};
export default App;
```
--------------------------------
### Dropdown With Icon Example
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/dropdown/Dropdown.mdx
Showcases the Dropdown component with icons integrated into its dropdown items. This variant enhances visual appeal and user recognition of options.
```javascript
import React from 'react';
import { DropdownWithIcon, DropdownWithIconCode } from './variant/DropdownWithIcon';
function App() {
return (
);
}
```
--------------------------------
### Tooltip with Arrow Example
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/tooltip/tooltip.mdx
Shows how to implement a tooltip with an optional arrow element to visually link the trigger with the tooltip content. The arrow must be rendered inside the TooltipContent.
```javascript
import React from 'react';
import { TooltipWithArrow, TooltipWithArrowCode } from './variant/TooltipWithArrow';
function App() {
return (
);
}
export default App;
```
--------------------------------
### Rating Types Example
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/rating/rating.mdx
Illustrates how to use custom rating icons to display the rating star. This allows for greater flexibility in the visual representation of user feedback.
```javascript
import React from 'react';
import { RatingTypes } from './variant/RatingTypes';
const App = () => {
return (
Custom Rating Icons
);
};
export default App;
```
--------------------------------
### Input Component Use Case
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/input/Input.mdx
Demonstrates a practical application or combination of input fields to showcase their usage in a real-world scenario. This example highlights how inputs can be integrated into forms or workflows.
```javascript
import React from 'react';
import { InputUseCases } from './InputUseCases';
const App = () => {
return (
);
};
export default App;
```
--------------------------------
### Default Line Chart Example
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/lineChart/LineChart.mdx
Demonstrates a basic Line Chart component, suitable for visualizing simple data trends. It uses default configurations for axes, lines, and tooltips.
```jsx
import React from 'react';
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend } from 'recharts';
const data = [
{ name: 'Page A', uv: 4000, pv: 2400, amt: 2400 },
{ name: 'Page B', uv: 3000, pv: 1398, amt: 2210 },
{ name: 'Page C', uv: 2000, pv: 9800, amt: 2290 },
{ name: 'Page D', uv: 2780, pv: 3908, amt: 2000 },
{ name: 'Page E', uv: 1890, pv: 4800, amt: 2181 },
{ name: 'Page F', uv: 2390, pv: 3800, amt: 2500 },
{ name: 'Page G', uv: 3490, pv: 4300, amt: 2100 },
];
const DefaultLineChart = () => (
);
export default DefaultLineChart;
```
--------------------------------
### Default Drawer Example (React)
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/drawer/Drawer.mdx
Demonstrates the basic usage of the Drawer component, showcasing how to render a simple drawer with default content. This snippet highlights the core functionality and integration within a React application.
```javascript
import { DefaultDrawer, DefaultDrawerCode } from './variant/DefaultDrawer'
import React from 'react';
// Example usage:
function App() {
return (
);
}
export default App;
```
--------------------------------
### Install Recharts for Bar Chart
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/barChart/BarChart.mdx
Installs the Recharts library, a dependency for using the Bar Chart component. This command ensures the necessary charting capabilities are available in your project.
```bash
npm install recharts
# or
yarn add recharts
```
--------------------------------
### Keep React Installation Configuration
Source: https://github.com/staticmania/keep-react/blob/main/data/blogs/keep-react-v1.5.0.mdx
This snippet demonstrates how to configure Keep React by importing `keepTheme` and setting up the theme configuration. It specifies content paths for Tailwind CSS and exports the theme configuration, enabling custom styling and theming for your React application.
```tsx
import { keepTheme } from 'keep-react/keepTheme'\n\nconst config = {\n content: ['./components/**/*.{js,ts,jsx,tsx,mdx}', './app/**/*.{js,ts,jsx,tsx,mdx}'],\n theme: {},\n}\n\nexport default keepTheme(config)
```
--------------------------------
### Keep React Default Pie Chart Example
Source: https://github.com/staticmania/keep-react/blob/main/app/docs/components/pieChart/PieChart.mdx
Demonstrates the basic implementation of the Pie Chart component. It displays data distribution with default styling and interactivity, suitable for straightforward data visualization.
```javascript
import React from 'react';
import { PieChart, Pie, Tooltip, Legend, Cell } from 'recharts';
const data = [
{ name: 'Group A', value: 400, color: '#0088FE' },
{ name: 'Group B', value: 300, color: '#00C49F' },
{ name: 'Group C', value: 300, color: '#FFBB28' },
{ name: 'Group D', value: 200, color: '#FF8042' },
];
const DefaultPie = () => (
{data.map((entry, index) => (
))}
);
export default DefaultPie;
```