### Navigate to Project Directory Source: https://preview.keenthemes.com/metronic8/react/docs/index Changes the current directory to the specified React demo path. This is the first step before installing dependencies. ```bash cd [unpacked path]/react/[demo] ``` -------------------------------- ### Install Project Dependencies Source: https://preview.keenthemes.com/metronic8/react/docs/index Installs local project dependencies required for the React application. Dependencies are listed in package.json and installed into the node_modules folder. ```bash npm install # OR yarn install ``` -------------------------------- ### Start Development Server Source: https://preview.keenthemes.com/metronic8/react/docs/index Launches the development server, which watches for file changes and rebuilds the application automatically. The app can then be accessed at http://localhost:5173/. ```bash npm run dev # OR yarn dev ``` -------------------------------- ### Basic React-Select Examples Source: https://preview.keenthemes.com/metronic8/react/docs/react-select Provides basic examples of the React-Select component with different background styles (default, transparent, solid). It includes defining options and rendering the Select component with a placeholder. ```javascript import { FC } from "react"; import Select from 'react-select' const Example1: FC = () => { const options = [ { value: 'option 1', label: 'Option 1' }, { value: 'option 2', label: 'Option 2' }, { value: 'option 3', label: 'Option 3' }, { value: 'option 4', label: 'Option 4' }, { value: 'option 5', label: 'Option 5' }, ] return ( <>
) } export { Example2 }; ``` -------------------------------- ### Basic Breadcrumb Example (React) Source: https://preview.keenthemes.com/metronic8/react/docs/breadcrumb Demonstrates a basic breadcrumb structure using an ordered list with linked list items. This example assumes a React environment and utilizes Bootstrap classes for styling. ```jsx
  1. Home
  2. Library
  3. Active
``` -------------------------------- ### Basic Flatpickr Examples in React Source: https://preview.keenthemes.com/metronic8/react/docs/flatpickr Demonstrates basic usage of the Flatpickr component in React with default and solid background input styles. It utilizes the `useState` hook to manage the selected date and includes placeholders for user interaction. ```javascript const Example1: FC = () => { const [dateState, setDateState] = useState({ date1: new Date(), date2: new Date() }); return ( <> { setDateState({ date1 }); }} className='form-control' placeholder='Pick date' /> { setDateState({ date2 }); }} className='form-control form-control-solid' placeholder='Pick date' /> ) } ``` -------------------------------- ### Apply Opacity Active State Classes in HTML Source: https://preview.keenthemes.com/metronic8/react/docs/helpers/opacity These HTML examples showcase the application of opacity classes for active states. Clicking on these elements will trigger a change in their opacity, providing visual cues for user interaction. ```html
``` -------------------------------- ### Basic Bootstrap Modal Example in React Source: https://preview.keenthemes.com/metronic8/react/docs/modal This snippet demonstrates how to implement a basic Bootstrap Modal in a React application using Metronic's components. It includes the button to trigger the modal and the modal's HTML structure with header, body, and footer. ```jsx
Modal title

Modal body text goes here.

``` -------------------------------- ### Basic Alert Example in React Source: https://preview.keenthemes.com/metronic8/react/docs/alerts Demonstrates a basic alert component in React using Metronic's styling. It includes an icon and text content, utilizing primary alert coloring. This component is suitable for general informational messages. ```jsx
...
This is an alert
The alert component can be used to highlight certain parts of your page for higher content visibility.
``` -------------------------------- ### React Flushed Button Example Source: https://preview.keenthemes.com/metronic8/react/docs/buttons Illustrates a 'flushed' button using the `.btn-flush` class, which removes paddings, borders, background, and rounded corners for a minimalist appearance. ```JSX Flushed button ``` -------------------------------- ### Enable Multi-Selection in React-Select Source: https://preview.keenthemes.com/metronic8/react/docs/react-select This example demonstrates how to enable multi-selection in a React-Select component using the `isMulti` attribute. It shows variations for small, default, and large sizes, allowing users to select multiple options and display them as tags. It takes an array of options and a placeholder. ```jsx import { FC } from "react"; import Select from 'react-select' const Example9: FC = () => { const options = [ { value: 'option 1', label: 'Option 1' }, { value: 'option 2', label: 'Option 2' }, { value: 'option 3', label: 'Option 3' }, { value: 'option 4', label: 'Option 4' }, { value: 'option 5', label: 'Option 5' }, ] return ( <>
) } export { Example3 }; ``` -------------------------------- ### React Base Button Styles Source: https://preview.keenthemes.com/metronic8/react/docs/buttons Demonstrates how to apply base button styles using the `.btn-{color}` class, which are defined by Metronic's SASS variables `$theme-colors`. These examples show different color options for anchor tag buttons. ```jsx White Primary Light Secondary Success Info Warning Danger Dark ``` -------------------------------- ### Display Text Labels with Symbol Source: https://preview.keenthemes.com/metronic8/react/docs/symbol This example showcases how to use the Symbol component to display text-based labels. It involves styling the `.symbol-label` element with utility classes for font size, weight, color, and background. Multiple variations demonstrate different text and background color combinations. ```jsx
A
L
C
T
X
S
``` -------------------------------- ### Toggling Indicator State with JavaScript (React) Source: https://preview.keenthemes.com/metronic8/react/docs/indicator Provides a React code example for dynamically toggling the Indicator component's state using the 'useRef' hook and JavaScript. It illustrates how to attach an event listener to a button and use 'setTimeout' to simulate a progress indication that automatically deactivates after a few seconds. ```javascript // import {useRef} from 'react'; // in your function add rows => const btnRef = useRef(null); const onClick = () => { // Disable indicator after 3 seconds btnRef.current?.setAttribute('data-kt-indicator', 'on'); setTimeout(() => { // Activate indicator btnRef.current?.removeAttribute("data-kt-indicator"); }, 3000); }; // in your HTML add ``` -------------------------------- ### Configure React Router for Custom Page Source: https://preview.keenthemes.com/metronic8/react/docs/create-a-page This code demonstrates how to update the React Router configuration to include a new route for the custom page. It involves importing the page component and adding a new Route element within the existing Routes structure. Ensure `react-router-dom` is installed and configured. ```tsx import {lazy, FC, Suspense} from 'react' import {Route, Routes, Navigate} from 'react-router-dom' import {MasterLayout} from '../../_metronic/layout/MasterLayout' import {DashboardWrapper} from '../pages/dashboard/DashboardWrapper' import {MenuTestPage} from '../pages/MenuTestPage' + import {MyPage} from "../pages/MyPage" export function PrivateRoutes() { const BuilderPageWrapper = lazy(() => import('../pages/layout-builder/BuilderPageWrapper')) const ProfilePage = lazy(() => import('../modules/profile/ProfilePage')) const WizardsPage = lazy(() => import('../modules/wizards/WizardsPage')) const AccountPage = lazy(() => import('../modules/accounts/AccountPage')) const WidgetsPage = lazy(() => import('../modules/widgets/WidgetsPage')) const ChatPage = lazy(() => import('../modules/apps/chat/ChatPage')) return ( return ( }> {/* Redirect to Dashboard after success login/registartion */} } /> {/* Pages */} +} /> } /> } /> } /> {/* Lazy Modules */} } /> } /> } /> } /> } /> {/* Page Not Found */} } /> ) } ``` -------------------------------- ### Enable Dark Mode SCSS Import in React Source: https://preview.keenthemes.com/metronic8/react/docs/dark-mode This snippet shows how to replace the default SCSS import with the dark mode SCSS file in the `index.tsx` file to enable dark mode styling. This is a direct replacement of one import statement. ```typescript - import './_metronic/assets/sass/style.scss' + import './_metronic/assets/sass/style.dark.scss' ``` -------------------------------- ### Basic Indicator Component Implementation (HTML) Source: https://preview.keenthemes.com/metronic8/react/docs/indicator Demonstrates the basic implementation of the Indicator component using HTML. It shows how to structure the button with separate spans for the label and progress message, and how to activate the indicator using the 'data-kt-indicator="on"' attribute. ```html ``` -------------------------------- ### React: Custom Sized Form Switches Source: https://preview.keenthemes.com/metronic8/react/docs/forms Provides examples of form switches with custom dimensions using Metronic's height ('h-') and width ('w-') utility classes. This allows for precise control over the switch's visual size, accommodating various design requirements. The examples show 20x30px, 30x50px, and 40x60px configurations. ```jsx
``` -------------------------------- ### Range Selection in Flatpickr React Source: https://preview.keenthemes.com/metronic8/react/docs/flatpickr Shows how to implement range date selection in Flatpickr. The `mode` option is set to 'range', allowing users to select a start and end date. The `onChange` event provides an array containing the start and end dates, managed via `useState`. Note that disabled dates are not selectable in range mode. ```javascript const Example5: FC = () => { const [dateState, setDateState] = useState({ startDate: new Date(), endDate: new Date() }); return <> { setDateState({ startDate, endDate }); }} options={{ mode: "range" }} className='form-control form-control-solid' placeholder='Pick date' /> } ``` -------------------------------- ### Toggle Active State and Rotate Icons Source: https://preview.keenthemes.com/metronic8/react/docs/rotate Provides examples of buttons where clicking toggles the 'active' class on the button element itself, dynamically rotating the associated icon. This utilizes an inline `onClick` handler to manage the class toggle. Note that some examples show the icon rotating to 90 degrees regardless of the button's intended rotation. ```jsx ``` -------------------------------- ### Card with Border Source: https://preview.keenthemes.com/metronic8/react/docs/cards This example shows a card with a border instead of a shadow, achieved by adding the `.card-border` class. This is useful for creating distinct visual separations. ```html

Title

Lorem Ipsum is simply dummy text...
Footer
``` -------------------------------- ### React: Build Nested Layouts with Flex Classes Source: https://preview.keenthemes.com/metronic8/react/docs/helpers/flex-layout Demonstrates using Metronic's responsive flex classes in React to create nested layouts with fixed and fluid columns. This example showcases various combinations of flex properties like `flex-row-auto`, `flex-column-fluid`, and `flex-center` to control layout dimensions and content alignment. No external dependencies beyond React itself are required for these classes. ```jsx
Fixed Height
Fluid Height
Fixed Height
Fluid Width
Fixed Width
``` -------------------------------- ### Metronic Width & Height Utility Classes (HTML) Source: https://preview.keenthemes.com/metronic8/react/docs/utilities These classes provide responsive control over an element's width and height properties, including min/max values. They utilize a `{property}-{size}` format and support responsive breakpoints. ```html
``` -------------------------------- ### Create React Page Component Source: https://preview.keenthemes.com/metronic8/react/docs/create-a-page This snippet shows how to create a basic React functional component for a new page. It defines the component's structure and its JSX return value. No external dependencies beyond React are required for this basic component. ```tsx import React from "react"; export function MyPage() { return

Hello!

} ``` -------------------------------- ### React Flex Button with Icon and Text Source: https://preview.keenthemes.com/metronic8/react/docs/buttons Shows a button styled with `.btn-flex` to vertically center its content. This example includes an SVG icon and text with a description, utilizing flexbox properties. ```JSX ... Caption Some description ``` -------------------------------- ### Disable Search in React-Select Source: https://preview.keenthemes.com/metronic8/react/docs/react-select This example shows how to disable the search functionality in a React-Select component by setting the `isSearchable` attribute to `false`. This is useful when you want to provide a simple dropdown without search input. It requires an array of options and a placeholder. ```jsx import { FC } from "react"; import Select from 'react-select' const Example7: FC = () => { const options = [ { value: 'option 1', label: 'Option 1' }, { value: 'option 2', label: 'Option 2' }, { value: 'option 3', label: 'Option 3' }, { value: 'option 4', label: 'Option 4' }, { value: 'option 5', label: 'Option 5' }, ] return (