apps/eclipse/content/design-system/components/typetable.mdx
import { TypeTable } from "@prisma/eclipse";
Basic Type Table
import { TypeTable } from "@prisma/eclipse";
export function ComponentProps() {
return (
<TypeTable
type={{
percentage: {
description: "The percentage of scroll position to display the roll button",
type: "number",
default: "0.2",
},
disabled: {
description: "Whether the component is disabled",
type: "boolean",
default: "false",
},
}}
/>
);
}
Live Example:
<TypeTable type={{ percentage: { description: "The percentage of scroll position to display the roll button", type: "number", default: "0.2", }, disabled: { description: "Whether the component is disabled", type: "boolean", default: "false", }, }} />
With Required Props
import { TypeTable } from "@prisma/eclipse";
export function RequiredProps() {
return (
<TypeTable
type={{
id: {
description: "Unique identifier for the component",
type: "string",
required: true,
},
onChange: {
description: "Callback function when value changes",
type: "(value: string) => void",
required: true,
},
placeholder: {
description: "Placeholder text to display",
type: "string",
},
}}
/>
);
}
Live Example:
<TypeTable type={{ id: { description: "Unique identifier for the component", type: "string", required: true, }, onChange: { description: "Callback function when value changes", type: "(value: string) => void", required: true, }, placeholder: { description: "Placeholder text to display", type: "string", }, }} />
With Complex Types
import { TypeTable } from "@prisma/eclipse";
export function ComplexTypes() {
return (
<TypeTable
type={{
variant: {
description: "Visual style variant",
type: '"primary" | "secondary" | "outline"',
default: '"primary"',
},
size: {
description: "Size of the component",
type: '"sm" | "md" | "lg"',
default: '"md"',
},
config: {
description: "Configuration object",
type: "{ theme: string; layout: string }",
},
}}
/>
);
}
Live Example:
<TypeTable type={{ variant: { description: "Visual style variant", type: '"primary" | "secondary" | "outline"', default: '"primary"', }, size: { description: "Size of the component", type: '"sm" | "md" | "lg"', default: '"md"', }, config: { description: "Configuration object", type: "{ theme: string; layout: string }", }, }} />
With Deprecated Props
import { TypeTable } from "@prisma/eclipse";
export function DeprecatedProps() {
return (
<TypeTable
type={{
color: {
description: "Color of the component",
type: "string",
},
bgColor: {
description: "Background color (use 'color' instead)",
type: "string",
deprecated: true,
},
}}
/>
);
}
Live Example:
<TypeTable type={{ color: { description: "Color of the component", type: "string", }, bgColor: { description: "Background color (use 'color' instead)", type: "string", deprecated: true, }, }} />
type - Record of type definitions to display (Record<string, TypeTableItem>, required)className - Additional CSS classes (optional)description - Description of the property (ReactNode, optional)type - Type of the property (ReactNode, required)typeDescription - Additional description for the type (ReactNode, optional)typeDescriptionLink - Link for the type description (string, optional)default - Default value (ReactNode, optional)required - Whether the property is required (boolean, optional)deprecated - Whether the property is deprecated (boolean, optional)parameters - Parameters for function types (array, optional)returns - Return type for function types (ReactNode, optional)