lara-light-indigo

Inplace

Inplace provides an easy to do editing and display at the same time where clicking the output displays the actual content.

Input
Click to Edit
Image
View Picture
Lazy Data
View Data
Import via Module

import { Inplace } from 'primereact/inplace';
 
Import via CDN

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

Inplace requires InplaceDisplay and InplaceContent component as children to define the content to display in each state. Active state of the inplace can either be managed as a Controlled or Uncontrolled component.

In controlled mode, active and onToggle properties need to be defined to control the active state.


<Inplace active={active} onToggle={(e) => setActive(e.value)}>
    <InplaceDisplay>
        Click to Edit
    </InplaceDisplay>
    <InplaceContent>
        <InputText />
    </InplaceContent>
</Inplace>
 

In uncontrolled mode, no additional properties are required. Initial state can be still be provided using the active property in uncontrolled mode however it is evaluated at initial rendering and ignored in further updates. If you programmatically need to update the active state, prefer to use the component as controlled.


<Inplace>
    <InplaceDisplay>
        Click to Edit
    </InplaceDisplay>
    <InplaceContent>
        <InputText autoFocus />
    </InplaceContent>
</Inplace>
 
Closable

closable property is handy within forms as it enables to get back to output mode after editing is completed using a button displayed next to the form field.


<Inplace closable>
    <InplaceDisplay>
        Click to Edit
    </InplaceDisplay>
    <InplaceContent>
        <InputText autoFocus />
    </InplaceContent>
</Inplace>
 
Lazy Loading

Inplace allows lazy loading content so that the content gets initialized after getting opened instead of on load. Here is an example that loads, data of a table if the user decides to open the inplace.


const onOpen = () => {
    productService.getProductsSmall().then(data => setProducts(data));
}

<Inplace onOpen={onOpen}>
    <InplaceDisplay>
        View Data
    </InplaceDisplay>
    <InplaceContent>
        <DataTable value={products}>
            <Column field="code" header="Code"></Column>
            <Column field="name" header="Name"></Column>
            <Column field="category" header="Category"></Column>
            <Column field="quantity" header="Quantity"></Column>
        </DataTable>
    </InplaceContent>
</Inplace>
 
Properties
NameTypeDefaultDescription
styleobjectnullInline style of the element.
classNamestringnullStyle class of the element.
activebooleanfalseWhether the content is displayed or not.
closablebooleanfalseDisplays a button to switch back to display mode.
disabledbooleanfalseWhen present, it specifies that the element should be disabled.
tabIndexnumbernullIndex of the element in tabbing order.
Events
NameParametersDescription
onOpenevent: browser event Callback to invoke when inplace is opened.
onCloseevent: browser event Callback to invoke when inplace is closed.
onToggleevent.originalEvent: browser event
event.value: active state as a boolean
Callback to invoke when inplace is opened or closed.
Styling

Following is the list of structural style classes, for theming classes visit theming page.

NameElement
p-inplaceContainer element
p-inplace-displayDisplay container
p-inplace-contentContent container
Accessibility

This section is under development. After the necessary tests and improvements are made, it will be shared with the users as soon as possible.

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