Skip to content

@graphty/graphty-element / config / defineOptions

Function: defineOptions() ​

defineOptions<S>(schema): S

Defined in: graphty-element/src/config/OptionsSchema.ts:89

Helper to define options with full type inference

Type Parameters ​

S ​

S extends OptionsSchema

Parameters ​

schema ​

S

Options schema definition

Returns ​

S

The same schema with full type inference

Example ​

typescript
export const myOptions = defineOptions({
    dampingFactor: {
        schema: z.number().min(0).max(1).default(0.85),
        meta: {
            label: "Damping Factor",
            description: "Probability of following a link",
            step: 0.05,
        },
    },
});