Pass Through

The Pass Through props is an API to access the internal DOM Structure of the components.

Each component has a special pt property to define an object with keys corresponding to the available DOM elements. Each value is also an object to define the arbitrary properties to apply to the element such as styling, aria, data-* or custom attributes. Every component documentation has a dedicated section to document the available section names exposed via PT.

Example below styles a Panel component with PrimeFlex CSS library.

Header

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.


<Panel
    header="Header"
    toggleable
    pt={{
        header: { className: 'bg-primary' },
        title: { className: 'text-white' },
        toggler: { className: 'text-white hover:bg-primary-reverse' }
    }}>
    <p className="m-0">
        Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
        consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
    </p>
</Panel>
         

PrimeReact components can be globally managed through a single source using the global pt object. Before using the pt state from PrimeReactContext, it is essential to encapsulate your application with PrimeReactProvider. For more details, click here.


// layout.js        
const { setPT } = useContext(PrimeReactContext);

setPT({
    panel: {
        header: { className: 'bg-primary' }
    },
    autocomplete: {
        input: { root: { className: 'w-16rem' } }
    }
});