### Run Development Server (npm or yarn) Source: https://coreui.io/react/docs/templates/installation Compiles CSS and JavaScript, builds documentation, and starts a local development server. This command allows you to preview the template in your browser during development. ```bash npm start ``` ```bash yarn start ``` -------------------------------- ### Install CoreUI for React (npm) Source: https://coreui.io/react/docs/index Installs the CoreUI UI component library for React.js using npm. This is the standard version. ```bash npm install @coreui/react @coreui/coreui ``` -------------------------------- ### Autocomplete - Setup and Basic Usage Source: https://coreui.io/react/docs/forms/autocomplete/api Demonstrates the basic setup and usage of the CoreUI React Autocomplete component, including setting initial values and handling user input. ```javascript import React, { useState } from 'react'; import { CAutocomplete } from '@coreui/react'; const MyComponent = () => { const [selectedValue, setSelectedValue] = useState(''); const options = [ { label: 'Option 1', value: '1' }, { label: 'Option 2', value: '2' }, { label: 'Option 3', value: '3' }, ]; return ( setSelectedValue(e.target.value)} /> ); }; export default MyComponent; ``` -------------------------------- ### Install Dependencies (npm or yarn) Source: https://coreui.io/react/docs/templates/installation Installs local dependencies required for the CoreUI React Admin Template from the `package.json` file. This step is crucial after downloading the template source files. ```bash npm install ``` ```bash yarn install ``` -------------------------------- ### Install CoreUI PRO for React (npm) Source: https://coreui.io/react/docs/index Installs the CoreUI PRO UI component library for React.js using npm. This is the premium version. ```bash npm install @coreui/react-pro @coreui/coreui-pro ``` -------------------------------- ### Install CoreUI for React (Yarn) Source: https://coreui.io/react/docs/index Installs the CoreUI UI component library for React.js using Yarn. This is the standard version. ```bash yarn add @coreui/react @coreui/coreui ``` -------------------------------- ### Install Bootstrap CSS Source: https://coreui.io/react/docs/index Installs the Bootstrap CSS framework using npm. This is required if you intend to use Bootstrap's styling with CoreUI components. ```bash npm install bootstrap ``` -------------------------------- ### Basic React Smart Table (DataTable) Usage Example Source: https://coreui.io/react/docs/components/smart-table Demonstrates the fundamental setup for a React Smart Table component, illustrating how to initialize and display tabular data with basic functionalities. This example is intended for integration within a React application. ```jsx import React from 'react'; import { CDataTable } from '@coreui/react'; const BasicTable = () => { const data = [ { id: 1, name: 'Leopold Gáspár', registered: '2010/02/01', role: 'Staff', status: 'Active' }, { id: 2, name: 'Estavan Lykos', registered: '2018/02/07', role: 'Staff', status: 'Banned' }, { id: 3, name: 'Avram Tarasios', registered: '2016/02/12', role: 'Staff', status: 'Banned' }, { id: 4, name: 'Nehemiah Tatius', registered: '2013/01/05', role: 'Staff', status: 'Banned' }, { id: 5, name: 'Chetan Mohamed', registered: '2020/01/15', role: 'Admin', status: 'Inactive' }, ]; const columns = [ { key: 'name', label: 'Name' }, { key: 'registered', label: 'Registered' }, { key: 'role', label: 'Role' }, { key: 'status', label: 'Status' }, ]; return ( ); }; export default BasicTable; ``` -------------------------------- ### Install CoreUI PRO for React (Yarn) Source: https://coreui.io/react/docs/index Installs the CoreUI PRO UI component library for React.js using Yarn. This is the premium version. ```bash yarn add @coreui/react-pro @coreui/coreui-pro ``` -------------------------------- ### React Popover Live Demo Example Source: https://coreui.io/react/docs/components/popover Demonstrates a basic live popover example in React using the CPopover component. It shows how to set a title and content, and trigger the popover with a button. ```javascript import React from 'react' import { CButton, CPopover } from '@coreui/react' export const PopoverLiveExample = () => { return ( Click to toggle popover ) } ``` ```typescript import React from 'react' import { CButton, CPopover } from '@coreui/react' export const PopoverLiveExample = () => { return ( Click to toggle popover ) } ``` -------------------------------- ### Static React Modal Component Example Source: https://coreui.io/react/docs/components/modal A basic, static modal component example using CoreUI React. It includes a header, body, and footer with dismiss and save actions. This example shows the fundamental structure of a modal without dynamic state management. ```jsx React Modal title

React Modal body text goes here.

Close Save changes
``` -------------------------------- ### Install CoreUI React Icons using npm Source: https://coreui.io/react/docs/components/icon Installs the CoreUI Icons and CoreUI Icons React packages using npm. ```bash npm install @coreui/icons @coreui/icons-react ``` -------------------------------- ### React CFooter Example Source: https://coreui.io/react/docs/components/footer Basic example of the CFooter component in React, demonstrating its structure with nested links and text. ```jsx
CoreUI © 2025 creativeLabs.
Powered by CoreUI
``` -------------------------------- ### Install CoreUI React Icons using Yarn Source: https://coreui.io/react/docs/components/icon Installs the CoreUI Icons and CoreUI Icons React packages using Yarn. ```bash yarn add @coreui/icons @coreui/icons-react ``` -------------------------------- ### React Toast with Live Example Source: https://coreui.io/react/docs/components/toast Shows how to implement a toast that can be sent dynamically, for example, by clicking a button. It uses React's `useState` and `useRef` hooks to manage the toast's visibility and an array of toasts. The example includes a button to trigger the toast and a `CToaster` component to display it. ```javascript import React, { useRef, useState } from 'react' import { CButton, CToast, CToastBody, CToaster, CToastHeader } from '@coreui/react' export const ToastLiveExample = () => { const [toast, addToast] = useState() const toaster = useRef(null) const exampleToast = (
CoreUI for React.js
7 min ago
Hello, world! This is a toast message.
) return ( <> addToast(exampleToast)}> Send a toast ) } ``` -------------------------------- ### Install @coreui/react-chartjs using npm Source: https://coreui.io/react/docs/components/chart Installs the @coreui/react-chartjs package using npm. This package is a React wrapper for Chart.js. ```bash npm install @coreui/react-chartjs ``` -------------------------------- ### React Autocomplete Basic Example with String Options Source: https://coreui.io/react/docs/forms/autocomplete Demonstrates a basic React Autocomplete implementation using a simple array of strings for options. This example highlights essential props for configuring the autocomplete's appearance and behavior. ```javascript import React from 'react' import { CAutocomplete } from '@coreui/react-pro' export const AutocompleteBasicExample = () => { return ( ) } ``` ```typescript import React from 'react' import { CAutocomplete } from '@coreui/react-pro' export const AutocompleteBasicExample = () => { return ( ) } ``` -------------------------------- ### CWidgetStatsB Example in React Source: https://coreui.io/react/docs/components/widgets Demonstrates the usage of the CWidgetStatsB component in React. It shows how to configure the widget with a title, value, helper text, and progress. The example includes variations with different colors and inverse styling, utilizing JavaScript and React. ```javascript import React from 'react' import { CCol, CRow, CWidgetStatsB } from '@coreui/react' export const WidgetStatsBExample = () => { return ( ) } ``` -------------------------------- ### React File Input Examples with CoreUI Source: https://coreui.io/react/docs/forms/input/bootstrap Provides examples of CoreUI's `CFormInput` for file uploads, demonstrating default, multiple file selection, disabled state, and small/large sizing options. Requires React and CoreUI. ```JavaScriptTypeScript import React from 'react' import { CFormInput } from '@coreui/react' export const FormInputFileExample = () => { return ( <>
) } ``` -------------------------------- ### CoreUI React: Between Breakpoints CSS Example Source: https://coreui.io/react/docs/layout/breakpoints Illustrates the CSS media query generated by the 'media-breakpoint-between' mixin. This example shows how to apply styles from the 'md' (medium) breakpoint up to the 'xl' (extra-large) breakpoint. ```css // Example // Apply styles starting from medium devices and up to extra large devices @media (min-width: 768px) and (max-width: 1199.98px) { ... } ``` -------------------------------- ### CoreUI React: Single Breakpoint CSS Example Source: https://coreui.io/react/docs/layout/breakpoints Provides the resulting CSS media query for the 'media-breakpoint-only' mixin. This example specifically shows the media query generated for the 'md' (medium) breakpoint. ```css @media (min-width: 768px) and (max-width: 991.98px) { ... } ``` -------------------------------- ### React Placeholder Example with Card Source: https://coreui.io/react/docs/components/placeholder Demonstrates using CoreUI's CPlaceholder component to create a loading state for a card component, mimicking the structure and size of a regular card but with placeholder elements. Includes both JavaScript and TypeScript examples. ```javascript import React from 'react' import { withPrefix } from 'gatsby' import { CButton, CCard, CCardBody, CCardImage, CCardText, CCardTitle, CPlaceholder, } from '@coreui/react' export const PlaceholderExample = () => { return ( <> Card title Some quick example text to build on the card title and make up the bulk of the card's content. Go somewhere Placeholder ) } ``` ```typescript import React from 'react' import { withPrefix } from 'gatsby' import { CButton, CCard, CCardBody, CCardImage, CCardText, CCardTitle, CPlaceholder, } from '@coreui/react' export const PlaceholderExample = () => { return ( <> Card title Some quick example text to build on the card title and make up the bulk of the card's content. Go somewhere Placeholder ) } ``` -------------------------------- ### React List Group with Links Example Source: https://coreui.io/react/docs/components/list-group Demonstrates creating actionable list group items using anchor (``) tags with the `as="a"` prop. It includes examples of active and disabled link items. ```javascript import React from 'react' import { CListGroup, CListGroupItem } from '@coreui/react' export const ListGroupLinksAndButtonsExample = () => { return ( Cras justo odio Dapibus ac facilisis in Morbi leo risus Porta ac consectetur ac Vestibulum at eros ) } ``` -------------------------------- ### React Default Sidebar Component Example Source: https://coreui.io/react/docs/components/sidebar This example demonstrates a default CoreUI React Sidebar component. It includes a header, brand, navigation items (with badges and dropdowns), and a footer with a toggler. Dependencies include '@coreui/react' and '@coreui/icons-react'. ```javascript import React from 'react' import { CBadge, CSidebar, CSidebarBrand, CSidebarHeader, CSidebarNav, CSidebarToggler, CNavGroup, CNavItem, CNavTitle, } from '@coreui/react' import CIcon from '@coreui/icons-react' import { cilCloudDownload, cilLayers, cilPuzzle, cilSpeedometer } from '@coreui/icons' export const SidebarExample = () => { return ( CoreUI Nav Title Nav item With badge NEW Nav dropdown } > Nav dropdown item Nav dropdown item Download CoreUI Try CoreUI PRO ) } ``` -------------------------------- ### React Offcanvas - Bottom Placement Example Source: https://coreui.io/react/docs/components/offcanvas/bootstrap Provides an example of a bottom-positioned offcanvas component built with CoreUI for React. It covers the necessary imports, state management, and component structure for a functional offcanvas. ```javascript import React, { useState } from 'react' import { CButton, CCloseButton, COffcanvas, COffcanvasBody, COffcanvasHeader, COffcanvasTitle, } from '@coreui/react' export const OffcanvasPlacementBottomExample = () => { const [visible, setVisible] = useState(false) return ( <> setVisible(true)}> Toggle bottom offcanvas setVisible(false)}> Offcanvas setVisible(false)} /> Content for the offcanvas goes here. You can place just about any React component or custom elements here. ) } ``` -------------------------------- ### CWidgetStatsC Example in React Source: https://coreui.io/react/docs/components/widgets Illustrates the implementation of the CWidgetStatsC component in React applications. This example showcases how to integrate the component with icons (using CIcon and cilChartPie) and configure its title, value, progress, and color. It covers both standard and inverse color schemes, written in JavaScript and React. ```javascript import React from 'react' import CIcon from '@coreui/icons-react' import { cilChartPie } from '@coreui/icons' import { CCol, CRow, CWidgetStatsC } from '@coreui/react' export const WidgetStatsCExample = () => { return ( } progress={{ color: 'success', value: 75 }} title="Widget title" value="89.9%" /> } color="primary" inverse progress={{ value: 75 }} title="Widget title" value="89.9%" /> ) } ``` -------------------------------- ### React Bootstrap Navbar with Basic Usage Example Source: https://coreui.io/react/docs/components/navbar/bootstrap Demonstrates the basic structure and functionality of the React Bootstrap Navbar component. It includes navigation links, a dropdown, a search form, and a toggle for collapsible content. This example requires React and CoreUI for React.js. ```javascript import React, { useState } from 'react' import { CButton, CCollapse, CContainer, CDropdown, CDropdownDivider, CDropdownItem, CDropdownMenu, CDropdownToggle, CForm, CFormInput, CNavbar, CNavbarBrand, CNavbarNav, CNavbarToggler, CNavItem, CNavLink, } from '@coreui/react' export const NavbarExample = () => { const [visible, setVisible] = useState(false) return ( Navbar setVisible(!visible)} /> Home Link Dropdown button Action Another action Something else here Disabled Search ) } ``` -------------------------------- ### Dropdown Responsive Alignment 2 Example Source: https://coreui.io/react/docs/components/dropdown/bootstrap Shows how to left-align a dropdown menu from a breakpoint using the 'md:start' alignment prop. This example utilizes CoreUI React components and is suitable for JavaScript/TypeScript. ```javascript import React from 'react' import { CDropdown, CDropdownDivider, CDropdownItem, CDropdownMenu, CDropdownToggle, } from '@coreui/react' export const DropdownResponsiveAlignment2Example = () => { return ( Right-aligned but left aligned when large screen Action Another action Something else here Separated link ) } ``` -------------------------------- ### Dropdown Responsive Alignment Source: https://coreui.io/react/docs/components/dropdown/bootstrap Examples of how to create responsive dropdown menus that align to the start or end based on screen size breakpoints. ```APIDOC ## CDropdown ### Description Allows for responsive alignment of dropdown menus. You can align the menu to the end (right) or start (left) of the dropdown toggle, and specify breakpoints for these alignments. ### Method N/A (Component Usage) ### Endpoint N/A (Component Usage) ### Parameters #### Props for `CDropdown` component: - **`alignment`** (string | object) - Required/Optional - Defines the alignment of the dropdown menu. Can be a simple string like `'end'` or `'start'`, or an object mapping breakpoints to alignment values (e.g., `{ xs: 'end', lg: 'start' }`). ### Request Example ```javascript Right-aligned menu example Action Another action Something else here Separated link ``` ```javascript Right-aligned but left aligned when large screen Action Another action Something else here Separated link ``` ### Response N/A (Component Usage) #### Success Response (200) N/A (Component Usage) #### Response Example N/A (Component Usage) ``` -------------------------------- ### React: List Group with Checkboxes Source: https://coreui.io/react/docs/components/list-group Example of creating a list group in React using CoreUI components, where each list item contains a checkbox. This setup is useful for selection lists. ```javascript import React from 'react' import { CFormCheck, CListGroup, CListGroupItem } from '@coreui/react' export const ListGroupCheckboxesAndRadiosExample = () => { return ( ) } ``` -------------------------------- ### Date Range Picker Month Selection - JavaScript/TypeScript Source: https://coreui.io/react/docs/forms/date-range-picker Enables month range selection by setting the `selectionType` property to `month`. Includes examples with and without pre-defined start and end dates. ```JavaScript import React from 'react' import { CCol, CRow } from '@coreui/react' import { CDateRangePicker } from '@coreui/react-pro' export const DateRangePickerMonthsExample = () => { return ( console.log(date)} onEndDateChange={(date) => console.log(date)} />{' '} console.log(date)} onEndDateChange={(date) => console.log(date)} />{' '} ) } ``` -------------------------------- ### Responsive Grid Classes (All Breakpoints) Source: https://coreui.io/react/docs/layout/grid Shows how to use CoreUI's grid system with all breakpoints, from extra-small to extra-large. The example demonstrates a row with equally sized columns and another row where columns have specific widths defined by `xs` props. ```jsx col col col col col-8 col-4 ``` -------------------------------- ### Linear React Stepper Example Source: https://coreui.io/react/docs/forms/stepper Demonstrates a linear React Stepper where users must complete steps sequentially. The `linear` prop is set to `true` (default behavior) to enforce this guided flow, ideal for checkout processes or registration wizards. ```javascript import React from 'react' import { CStepper } from '@coreui/react-pro' export const StepperLinearExample = () => { return } ``` -------------------------------- ### Build Production Files (npm or yarn) Source: https://coreui.io/react/docs/templates/installation Creates the `dist/` directory containing compiled files for production deployment. This process utilizes Sass and Autoprefixer for optimal CSS output. ```bash npm run build ``` ```bash yarn build ``` -------------------------------- ### Responsive Alignment for Dropdown Menu (React) Source: https://coreui.io/react/docs/components/dropdown Shows how to implement responsive alignment for dropdown menus in CoreUI React, allowing alignment changes based on screen breakpoints. This example aligns the menu to the end for small screens and left for larger screens using `alignment={{ xs: 'end', lg: 'start' }}`. ```javascript import React from 'react' import { CDropdown, CDropdownDivider, CDropdownItem, CDropdownMenu, CDropdownToggle, } from '@coreui/react' export const DropdownResponsiveAlignment2Example = () => { return ( Right-aligned but left aligned when large screen Action Another action Something else here Separated link ) } ``` -------------------------------- ### Sass: Import specific CoreUI parts using @import Source: https://coreui.io/react/docs/customize/sass This example details importing specific CoreUI Sass files using the deprecated `@import` rule. It outlines the recommended order of imports, starting with functions and variables, and then including various components and utilities. This approach allows for granular control over which parts of CoreUI are included in your project. ```sass // Custom.scss // Option B: Include parts of CoreUI // 1. Include functions first (so you can manipulate colors, SVGs, calc, etc) @import "../node_modules/@coreui/coreui/scss/functions"; // 2. Include any default variable overrides here // 3. Include remainder of required CoreUI stylesheets @import "../node_modules/@coreui/coreui/scss/variables"; // 4. Include any default map overrides here // 5. Include remainder of required parts @import "../node_modules/@coreui/coreui/scss/maps"; @import "../node_modules/@coreui/coreui/scss/mixins"; @import "../node_modules/@coreui/coreui/scss/root"; // 6. Optionally include any other parts as needed @import "../node_modules/@coreui/coreui/scss/utilities"; @import "../node_modules/@coreui/coreui/scss/reboot"; @import "../node_modules/@coreui/coreui/scss/type"; @import "../node_modules/@coreui/coreui/scss/images"; @import "../node_modules/@coreui/coreui/scss/containers"; @import "../node_modules/@coreui/coreui/scss/grid"; @import "../node_modules/@coreui/coreui/scss/helpers"; // 7. Optionally include utilities API last to generate classes based on the Sass map in `_utilities.scss` @import "../node_modules/@coreui/coreui/scss/utilities/api"; // 8. Add additional custom code here ``` -------------------------------- ### Import CoreUI React Component Source: https://coreui.io/react/docs/getting-started/introduction Demonstrates how to import a CoreUI component for React.js into your project. ```javascript import { CAlert } from '@coreui/react'; ``` -------------------------------- ### Callback for Start Date Change in React Calendar Source: https://coreui.io/react/docs/components/calendar/api Fired when the start date in a date range selection is updated. This callback is valuable for updating application states or triggering side effects based on the selected start date, including an optional formatted date. ```typescript onStartDateChange: (date: string | Date, formatedDate?: string) => void; ``` -------------------------------- ### Install @coreui/react-chartjs using Yarn Source: https://coreui.io/react/docs/components/chart Installs the @coreui/react-chartjs package using Yarn. This package is a React wrapper for Chart.js. ```bash yarn add @coreui/react-chartjs ``` -------------------------------- ### Import CoreUI PRO React Component Source: https://coreui.io/react/docs/getting-started/introduction Demonstrates how to import a CoreUI PRO component for React.js into your project. ```javascript import { CAlert } from '@coreui/react-pro'; ``` -------------------------------- ### Run Tests (npm or yarn) Source: https://coreui.io/react/docs/templates/installation Executes the test suite for the CoreUI React Admin Template locally. This helps ensure the code functions as expected. ```bash npm test ``` ```bash yarn test ``` -------------------------------- ### React Smart Pagination Basic Example Source: https://coreui.io/react/docs/components/smart-pagination Demonstrates the basic usage of the CSmartPagination component in React. It shows how to set the active page and the total number of pages, and handle page changes. ```javascript import React, { useState } from 'react' import { CSmartPagination } from '@coreui/react-pro' export const SmartPaginationExample = () => { const [currentPage, setCurrentPage] = useState(1) return ( ) } ``` -------------------------------- ### React Loading Button Examples Source: https://coreui.io/react/docs/components/loading-button Demonstrates basic usage of the CLoadingButton component with different color and variant options. ```APIDOC ## CLoadingButton Component Usage ### Description Examples of creating basic React Loading Buttons with primary, outline, and ghost styles. ### Example Usage ```javascript Submit Submit Submit ``` ``` -------------------------------- ### React Header Basic Usage Example Source: https://coreui.io/react/docs/components/header Demonstrates the basic implementation of a responsive CoreUI React Header component. It includes navigation links, a dropdown, and a search form, utilizing various sub-components like CHeaderBrand, CHeaderNav, CCollapse, and CForm. ```jsx const [visible, setVisible] = useState(false) return ( <> Header setVisible(!visible)} /> Home Link Dropdown button Action Another action Something else here Disabled Search ) ``` -------------------------------- ### Install react-imask (yarn) Source: https://coreui.io/react/docs/forms/input-mask Installs the react-imask library using yarn, a prerequisite for extending CoreUI React components with input masking. ```bash yarn add react-imask ``` -------------------------------- ### Install react-imask (npm) Source: https://coreui.io/react/docs/forms/input-mask Installs the react-imask library using npm, which is required to add input masking functionality to React components. ```bash npm install react-imask ``` -------------------------------- ### Mix and Match Responsive Classes Source: https://coreui.io/react/docs/layout/grid Provides an example of combining different responsive classes across various breakpoints (`md`, `xs`) to create complex layouts. This showcases flexibility in defining column behavior at different screen sizes. ```jsx .col-md-8 .col-6 .col-md-4 .col-6 .col-md-4 .col-6 .col-md-4 .col-6 .col-md-4 .col-6 .col-6 ``` -------------------------------- ### React Callout Component Examples Source: https://coreui.io/react/docs/components/callout Demonstrates the usage of the React Callout component with various color props for different contextual styles. Requires the '@coreui/react' library. ```javascript import React from 'react' import { CCallout } from '@coreui/react' export const CalloutExample = () => { return ( <> New to or unfamiliar with flexbox? Read this CSS Tricks flexbox guide for background, terminology, guidelines, and code snippets. New to or unfamiliar with flexbox? Read this CSS Tricks flexbox guide for background, terminology, guidelines, and code snippets. New to or unfamiliar with flexbox? Read this CSS Tricks flexbox guide for background, terminology, guidelines, and code snippets. New to or unfamiliar with flexbox? Read this CSS Tricks flexbox guide for background, terminology, guidelines, and code snippets. New to or unfamiliar with flexbox? Read this CSS Tricks flexbox guide for background, terminology, guidelines, and code snippets. New to or unfamiliar with flexbox? Read this CSS Tricks flexbox guide for background, terminology, guidelines, and code snippets. New to or unfamiliar with flexbox? Read this CSS Tricks flexbox guide for background, terminology, guidelines, and code snippets. New to or unfamiliar with flexbox? Read this CSS Tricks flexbox guide for background, terminology, guidelines, and code snippets. ) } ``` -------------------------------- ### Clone CoreUI Free React Admin Template Repository Source: https://coreui.io/react/docs/templates/download This command clones the CoreUI Free React Admin Template from GitHub. It requires Git to be installed and configured on your system. The cloned repository provides the source code for building React applications. ```git git clone https://github.com/coreui/coreui-free-react-admin-template.git my-project ```