Configure length and time generics in CSS.Properties
masterAll interfaces accept two optional generic arguments to customize how length and time values are typed: CSS.Properties<TLength = string | 0, TTime = string>.
- Length (
TLength): Defaults tostring | 0. Use this to allow numeric values (e.g.,string | number) for platforms that don't require unit identifiers. - Time (
TTime): Defaults tostring. Use this to allow numeric values (e.g.,string | number) for time-based properties.
// Customizing Length
const style: CSS.Properties<string | number> = {
width: 100,
};
// Customizing both Length and Time
const style: CSS.Properties<string | number, number> = {
transitionDuration: 1000,
};const style: CSS.Properties<string | number> = {
width: 100,
};