lara-light-indigo

StyleClass

StyleClass manages css classes declaratively to during enter/leave animations or just to toggle classes on an element.

Toggle Class
Animations
Import via Module

import { StyleClass } from 'primereact/styleclass';
 
Import via CDN

<script src="https://unpkg.com/primereact/core/core.min.js"></script>
<script src="https://unpkg.com/primereact/styleclass/styleclass.min.js"></script>
 
Getting Started

Required prop nodeRef needs to be bind to target's ref which is DOM element. StyleClass has two modes, toggleClassName to simply add-remove a class and enter/leave animations.

ToggleClass


<StyleClass nodeRef={toggleBtnRef} selector="@next" toggleClassName="p-disabled">
    <Button ref={toggleBtnRef} label="Toggle p-disabled" />
</StyleClass>
<InputText className="block mt-3" />
 

Enter/Leave Animation


<StyleClass nodeRef={openBtnRef} selector=".box" enterClassName="hidden" enterActiveClassName="my-fadein">
    <Button ref={openBtnRef} label="Show" className="mr-2" />
</StyleClass>

<StyleClass nodeRef={closeBtnRef} selector=".box" leaveActiveClassName="my-fadeout" leaveToClassName="hidden">
    <Button ref={closeBtnRef} label="Hide" />
</StyleClass>

<div className="box hidden">Content</div>
 
Target

Target element is defined with the selector prop that can either be a valid css query or one of the keywords below.

NameDescription
@nextNext element.
@prevPrevious element.
@parentParent element.
@grandparentParent element of the parent.
Properties
NameTypeDefaultDescription
selectorstringnullSelector to define the target element.
nodeRefanynullA React reference to DOM element that need to specify. Required
enterClassNamestringnullStyle class to add when item begins to get displayed.
enterActiveClassNamestringnullStyle class to add during enter animation.
enterToClassNamestringnullStyle class to add when enter animation is completed.
leaveClassNamestringnullStyle class to add when item begins to get hidden.
leaveActiveClassNamestringnullStyle class to add during leave animation
leaveToClassNamestringnullStyle class to add when leave animation is completed.
hideOnOutsideClickbooleanfalseWhether to trigger leave animation when outside of the element is clicked.
toggleClassNamestringnullAdds or removes a class when no enter-leave animation is required.
Events

Component has no events.

Dependencies

None.

Component Scale

Input Style

Ripple Effect

Free Themes

Built-in component themes created by the PrimeReact Theme Designer.

Bootstrap
Blue
Purple
Blue
Purple
Material Design
Indigo
Deep Purple
Indigo
Deep Purple
Material Design Compact
Indigo
Deep Purple
Indigo
Deep Purple
Tailwind
Tailwind Light
Fluent UI
Blue
PrimeOne Design - 2022 NEW
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
Lara Indigo
Lara Blue
Lara Purple
Lara Teal
PrimeOne Design - 2021
Saga Blue
Saga Green
Saga Orange
Saga Purple
Vela Blue
Vela Green
Vela Orange
Vela Purple
Arya Blue
Arya Green
Arya Orange
Arya Purple
Premium Themes

Premium themes are only available exclusively for PrimeReact Theme Designer subscribers and therefore not included in PrimeReact core.

Soho Light
Soho Dark
Viva Light
Viva Dark
Mira
Nano

Legacy Free Themes

Nova
Nova Alt
Nova Accent
Luna Blue
Luna Green
Luna Amber
Luna Pink
Rhea

Premium Create-React-App Templates

Beautifully crafted premium create-react-app application templates by the PrimeTek design team.

Sakai
Atlantis
Freya
Ultima
Diamond
Sapphire
Serenity
Babylon
Avalon
Apollo
Roma