Props Definition

Verze:

31. 12. 2025

Zodpovědná osoba:

Dominik Šlechta

Props MUST be defined using TypeScript interface with defineProps. Default values MUST be defined using withDefaults().

Props MUST be defined using TypeScript interface with defineProps<Props>().

Default values MUST be defined using withDefaults().

Optional props MUST use the ? syntax.

Example:

interface Props {
    product: Product
    variant?: 'primary' | 'secondary'
    discount?: number
    categories?: Category[]
}

const props = withDefaults(defineProps<Props>(), {
    variant: 'primary',
    categories: () => [],
})