radix-vue
Version:
Vue port for Radix UI Primitives.
146 lines (145 loc) • 4.83 kB
TypeScript
import type { ComputedRef, Ref } from 'vue';
import type { PrimitiveProps } from '../Primitive';
import type { DataOrientation, Direction, Type } from '../shared/types';
export interface AccordionRootProps extends PrimitiveProps {
/**
* Determines whether one or multiple items can be opened at the same time.
*/
type: Type;
/**
* The controlled value of the item to expand when type is "single" or the controlled values of the items to expand when type is "multiple".
*/
modelValue?: string | string[];
/**
* The default value of the item to expand when type is "single" or the default values of the items to expand when type is "multiple".
* Use when you do not need to control the state of the item(s).
*/
defaultValue?: string | string[];
/**
* When type is "single", allows closing content when clicking trigger for an open item.
* When type is "multiple", this prop has no effect.
*
* @default false
*/
collapsible?: boolean;
/**
* When true, prevents the user from interacting with the accordion and all its items
*
* @default false
*/
disabled?: boolean;
/**
* The reading direction of the accordion when applicable. If omitted, assumes LTR (left-to-right) reading mode.
*
* @default "ltr"
*/
dir?: Direction;
/**
* The orientation of the accordion.
*
* @default "vertical"
*/
orientation?: DataOrientation;
}
export type AccordionRootEmits = {
'update:modelValue': [value: string | string[] | undefined];
};
export type AccordionRootContext = {
disabled: Ref<AccordionRootProps['disabled']>;
direction: Ref<AccordionRootProps['dir']>;
orientation: AccordionRootProps['orientation'];
parentElement: Ref<HTMLElement | undefined>;
changeModelValue(value: string): void;
isSingle: ComputedRef<boolean>;
modelValue: Ref<string | undefined | string[]>;
collapsible: boolean;
};
export declare const injectAccordionRootContext: <T extends AccordionRootContext | null | undefined = AccordionRootContext>(fallback?: T | undefined) => T extends null ? AccordionRootContext | null : AccordionRootContext, provideAccordionRootContext: (contextValue: AccordionRootContext) => AccordionRootContext;
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<{
dir: {
type: import("vue").PropType<Direction>;
};
disabled: {
type: import("vue").PropType<boolean>;
default: boolean;
};
type: {
type: import("vue").PropType<Type>;
required: true;
};
asChild: {
type: import("vue").PropType<boolean>;
default: boolean;
};
as: {
type: import("vue").PropType<import('../Primitive').AsTag | import("vue").Component>;
};
defaultValue: {
type: import("vue").PropType<string | string[]>;
};
orientation: {
type: import("vue").PropType<DataOrientation>;
default: string;
};
modelValue: {
type: import("vue").PropType<string | string[]>;
};
collapsible: {
type: import("vue").PropType<boolean>;
default: boolean;
};
}, {
modelValue: Ref<string | string[] | undefined>;
}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
"update:modelValue": (value: string | string[] | undefined) => void;
}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
dir: {
type: import("vue").PropType<Direction>;
};
disabled: {
type: import("vue").PropType<boolean>;
default: boolean;
};
type: {
type: import("vue").PropType<Type>;
required: true;
};
asChild: {
type: import("vue").PropType<boolean>;
default: boolean;
};
as: {
type: import("vue").PropType<import('../Primitive').AsTag | import("vue").Component>;
};
defaultValue: {
type: import("vue").PropType<string | string[]>;
};
orientation: {
type: import("vue").PropType<DataOrientation>;
default: string;
};
modelValue: {
type: import("vue").PropType<string | string[]>;
};
collapsible: {
type: import("vue").PropType<boolean>;
default: boolean;
};
}>> & {
"onUpdate:modelValue"?: ((value: string | string[] | undefined) => any) | undefined;
}, {
disabled: boolean;
asChild: boolean;
orientation: DataOrientation;
collapsible: boolean;
}, {}>, {
default?(_: {
modelValue: string | string[] | undefined;
}): any;
}>;
export default _default;
type __VLS_WithTemplateSlots<T, S> = T & {
new (): {
$slots: S;
};
};