Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

919 B
Raw Blame
/**
 * @deprecated This component will be replaced by the Element component in the future.
 * Use Element with tag="ul" or tag="ol" instead.
 */
import {
  forwardRef,
  createElement,
  type ElementRef,
  type ComponentProps,
} from "react";

const unorderedTag = "ul";
const orderedTag = "ol";

export type ListTag = typeof unorderedTag | typeof orderedTag;

type Props = ComponentProps<typeof unorderedTag> &
  ComponentProps<typeof orderedTag> & {
    /** Shows numbers instead of bullets when toggled. See the “List Style Type” property under the “List Item” section in the Style panel for more options. */
    ordered?: boolean;
  };

export const List = forwardRef<
  ElementRef<typeof unorderedTag | typeof orderedTag>,
  Props
>(({ ordered = false, ...props }, ref) => {
  const tag = ordered ? orderedTag : unorderedTag;
  return createElement(tag, { ...props, ref });
});

List.displayName = "List";