Home

Awesome

npm build status bitHound Score

react-adminlte-dash

React.js components for AdminLTE themed dashboard.

Based off of AdminLTE. Static hosted demo on GitHub Pages.

Todo (Path to 1.0.0)

Installation

npm install --save react-adminlte-dash

Usage

This module is in development, usage is subject to change. Not all components are fully functional.

This module uses Styled Components, so all CSS styling is included when the module is called. However, in order for the dashboard to use the entire available screen height, the parent container components must be set to height: 100%. This component sets the html & body styles, the user must set the app container.

In CSS:

#app {
  min-height: 100vh;
}

In ES6:

import { Dashboard, Header, Sidebar } from 'react-adminlte-dash';

const nav = () => ([
  <Header.Item href="/some/link" key="1" />
]);

const sb = () => ([
  <Sidebar.Menu header="NAVIGATION" key="1">
    <Sidebar.Menu.Item title="Home" href="/" />
  </Sidebar.Menu>
]);

const App = ({ children }) => (
  <Dashboard
    navbarChildren={nav()}
    sidebarChildren={sb()}
    theme="skin-blue"
  >
    {children}
  </Dashboard>
);

In order to create themed child components (not wrapped in navbarChildren, sidebarChildren, or footerChildren), use the withTheme wrapper provided by styled-components. This will provide the theme object to the child component. See src/styles/variables.js for the available variables. Documentation for these variables is TBD.

Included Components

Dashboard

Main component for theme. Handles theming, layout options, and tracks state. Provides a default empty header and sidebar.

PropertyTypeDescriptionDefault
childrennodeAny React child components to be rendered in content fieldsn/a
navbarChildrennodeAny React child components to be rendered in the Header's navbarn/a
sidebarChildrennodeAny React child components to be rendered in the Sidebarn/a
footerChildrennodeAny React child components to be rendered in the Footern/a
themestringChoice of AdminLTE skin themes: skin-blue, skin-black, skin-purple, skin-green, skin-red, skin-yellow, skin-blue-light, skin-black-light, skin-purple-light, skin-green-light, skin-red-light, skin-yellow-lightskin-blue
initialCollapseboolDetermines initial state of sidebar: collapsed (true) or expanded (false)false
sidebarMiniboolDetermines whether sidebar collapses to mini size (true) or off-screen (false)true
fixedboolDetermines whether the Header is fixedfalse
logoOnClickfuncFunction to be called on logo click, overrides logoHrefn/a
logoHrefstringLink target for Logo, overridden by logoOnClick'/'
logoLgelementA single React component to be rendered when logo is in large state<span><b>Admin</b>LTE</span>
logoSmelementA single React component to be rendered when logo is in small state<span><b>A</b>LT</span>

Header

Header component which can be used independently of Dashboard (TBD). Wrapper for any top-based navigation components. Provides the following subcomponents:

PropertyTypeDescriptionDefault
childrennodeAny React child components to be renderedn/a
fixedboolDetermines whether the Header is fixedfalse
logoOnClickfuncFunction to be called on logo click, overrides logoHrefn/a
logoHrefstringLink target for Logo, overridden by logoOnClick'/'
logoLgelementA single React component to be rendered when logo is in large state<span><b>Admin</b>LTE</span>
logoSmelementA single React component to be rendered when logo is in small state<span><b>A</b>LT</span>
sidebarMiniboolDetermines whether sidebar collapses to mini size (true) or off-screen (false)false
sidebarCollapseboolDetermines whether sidebar is in a collapsed statefalse
sidebarTogglefunc(Required) function passed to sidebar toggle component to handle sidebar collapse staten/a

Header.Item

Header navbar menu item component. Renders links with images in header.

PropertyTypeDescriptionDefault
titlestringItem title to be displayedn/a
onClickfuncFunction to be called on item clickn/a
linkstringLink target for logo component, overridden by onClickn/a
imagestringPath to image object, overrides iconClassn/a
iconClassstringClass names to use for icon (libraries not included),n/a

Header.UserMenu

Header user menu component. Renders user menu dropdown component in header bar.

PropertyTypeDescriptionDefault
namestringUser Namen/a
imagestringPath to user image objectn/a
profileActionfuncFunction to perform on selection of Profile button, button only displayed if action providedn/a
signOutActionfuncFunction to perform on selection of Sign Out button, button only displayed if action providedn/a

Sidebar

Sidebar component which can be used independently of Dashboard (TBD). Wrapper for any sidebar navigation components. Provides the following subcomponents:

PropertyTypeDescriptionDefault
childrennodeAny React child components to be renderedn/a
fixedboolDetermines whether the Header is fixedfalse
sidebarMiniboolDetermines whether sidebar collapses to mini size (true) or off-screen (false)false
sidebarCollapseboolDetermines whether sidebar is in a collapsed statefalse

Sidebar.Menu

Sidebar navigation menu component. Wrapper for SidebarMenuItem components, which are provided as subcomponent:

PropertyTypeDescriptionDefault
childrennodeAny React child components to be renderedn/a
headerstringHeader title for navigation componentnone

Sidebar.Menu.Item

Sidebar navigation menu item component. Renders as link or dropdown menu. Can be nested in itself to provided nested dropdown menus.

<Sidebar.Menu.Item title="Level 1">
  <Sidebar.Menu.Item title="Level 2">
    <Sidebar.Menu.Item title="Level 3" />
  </Sidebar.Menu.Item>
</Sidebar.Menu.Item>
PropertyTypeDescriptionDefault
childrennodeAny React child components to be renderedn/a
titlestringTitle for componentnone
activeboolDetermines if item is considered activefalse
hrefstringLink target for component, unused if onClick or children providednull
onClickfuncAction for component, unused if children provided, overrides hrefnull
iconobjectExpects a className key which accepts a string describing any font-awesome icon (i.e. fa-th) and/or a color key which accepts any Bootstrap style type (i.e. danger) or CSS color string (hex, name, or rgb){ className: 'fa-circle-o' }
labels[objects]Array of objects, each requires a React key string, a type key which accepts a string describing any Bootstrap style type (i.e. danger) and a text key of any string to displayn/a

Sidebar.Search

Sidebar search component.

PropertyTypeDescriptionDefault
namestringInitial value displayed in search field''
placeholderstringInitial value displayed in search field'Search...'
onClickfuncFunction to call on search submit, provided with value propv => alert(Searching for ${v})

Sidebar.UserPanel

Sidebar user component.

PropertyTypeDescriptionDefault
namestringUser namen/a
imagestringString providing source path for user imagen/a
onlineboolUser status: online = true, offline = falsefalse
hrefstringTarget for user status linkn/a

License

react-adminlte-dash is available under MIT. See LICENSE for more details.