index.d.mts 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import * as React from "react";
  2. import * as Radix from "@radix-ui/react-primitive";
  3. import { Primitive } from "@radix-ui/react-primitive";
  4. import * as RovingFocusGroup from "@radix-ui/react-roving-focus";
  5. export const createTabsScope: import("@radix-ui/react-context").CreateScope;
  6. type RovingFocusGroupProps = Radix.ComponentPropsWithoutRef<typeof RovingFocusGroup.Root>;
  7. type PrimitiveDivProps = Radix.ComponentPropsWithoutRef<typeof Primitive.div>;
  8. export interface TabsProps extends PrimitiveDivProps {
  9. /** The value for the selected tab, if controlled */
  10. value?: string;
  11. /** The value of the tab to select by default, if uncontrolled */
  12. defaultValue?: string;
  13. /** A function called when a new tab is selected */
  14. onValueChange?: (value: string) => void;
  15. /**
  16. * The orientation the tabs are layed out.
  17. * Mainly so arrow navigation is done accordingly (left & right vs. up & down)
  18. * @defaultValue horizontal
  19. */
  20. orientation?: RovingFocusGroupProps['orientation'];
  21. /**
  22. * The direction of navigation between toolbar items.
  23. */
  24. dir?: RovingFocusGroupProps['dir'];
  25. /**
  26. * Whether a tab is activated automatically or manually.
  27. * @defaultValue automatic
  28. * */
  29. activationMode?: 'automatic' | 'manual';
  30. }
  31. export const Tabs: React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement>>;
  32. export interface TabsListProps extends PrimitiveDivProps {
  33. loop?: RovingFocusGroupProps['loop'];
  34. }
  35. export const TabsList: React.ForwardRefExoticComponent<TabsListProps & React.RefAttributes<HTMLDivElement>>;
  36. type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
  37. export interface TabsTriggerProps extends PrimitiveButtonProps {
  38. value: string;
  39. }
  40. export const TabsTrigger: React.ForwardRefExoticComponent<TabsTriggerProps & React.RefAttributes<HTMLButtonElement>>;
  41. export interface TabsContentProps extends PrimitiveDivProps {
  42. value: string;
  43. /**
  44. * Used to force mounting when more control is needed. Useful when
  45. * controlling animation with React animation libraries.
  46. */
  47. forceMount?: true;
  48. }
  49. export const TabsContent: React.ForwardRefExoticComponent<TabsContentProps & React.RefAttributes<HTMLDivElement>>;
  50. export const Root: React.ForwardRefExoticComponent<TabsProps & React.RefAttributes<HTMLDivElement>>;
  51. export const List: React.ForwardRefExoticComponent<TabsListProps & React.RefAttributes<HTMLDivElement>>;
  52. export const Trigger: React.ForwardRefExoticComponent<TabsTriggerProps & React.RefAttributes<HTMLButtonElement>>;
  53. export const Content: React.ForwardRefExoticComponent<TabsContentProps & React.RefAttributes<HTMLDivElement>>;
  54. //# sourceMappingURL=index.d.ts.map