You can now override each and every slotProps
type. With this you can pass custom properties into each slotProps
with a simple module augmentation.
This will allow you to have custom properties that is available both on slotProps
definition and component prop as well.
Most of the component props are available to override.
Look for exported interfaces with the name of the component that you want to augment and Overrides
suffix.
Define your custom types like the following:
declare module '@knightburton/react-interval-calendar' {
interface ContainerPropsOverrides {
something?: boolean;
}
}
// In your component, you can define the value like the this
<IntervalCalendar
weekStartsOn={1}
start={new Date(2021, 1, 1)}
end={new Date(2021, 6, 31)}
slotProps={{ root: { something: true } }}
/>
// Also, this will be available on component props as well
const Root = ({ children, something }: ContainerProps): JSX.Element => <></>;
The list of overridable component props:
ContainerPropsOverrides
, HeaderPropsOverrides
, HeaderCellPropsOverrides
, HeaderCellContentPropsOverrides
, BodyPropsOverrides
, BodyRowPropsOverrides
, BodyCellPropsOverrides
, BodyCellContentPropsOverrides
and EmptyPropsOverrides