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.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
enable choosing the tag for Heading
Oleg Isonenc3c797a7c04b
diff --git a/packages/react-sdk/src/components/heading.props.json b/packages/react-sdk/src/components/heading.props.jsonindex 839f40892d..48653c09cd 100644--- a/packages/react-sdk/src/components/heading.props.json+++ b/packages/react-sdk/src/components/heading.props.json@@ -2200,5 +2200,47 @@"control": {"type": "text"}+ },+ "tag": {+ "defaultValue": {+ "value": "h1"+ },+ "description": "",+ "name": "tag",+ "declarations": [+ {+ "fileName": "src/components/heading.tsx",+ "name": "TypeLiteral"+ }+ ],+ "required": false,+ "type": {+ "name": "enum",+ "raw": "\"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\"",+ "value": [+ {+ "value": "\"h1\""+ },+ {+ "value": "\"h2\""+ },+ {+ "value": "\"h3\""+ },+ {+ "value": "\"h4\""+ },+ {+ "value": "\"h5\""+ },+ {+ "value": "\"h6\""+ }+ ]+ },+ "control": {+ "type": "select"+ },+ "options": ["h1", "h2", "h3", "h4", "h5", "h6"]}}diff --git a/packages/react-sdk/src/components/heading.tsx b/packages/react-sdk/src/components/heading.tsxindex 7345676220..a37abcdabd 100644--- a/packages/react-sdk/src/components/heading.tsx+++ b/packages/react-sdk/src/components/heading.tsx@@ -2,9 +2,19 @@ import React, { forwardRef, type ElementRef, type ComponentProps } from "react";const defaultTag = "h1";-export const Heading = forwardRef<- ElementRef<typeof defaultTag>,- ComponentProps<typeof defaultTag>->((props, ref) => <h1 {...props} ref={ref} />);+type Props = ComponentProps<typeof defaultTag> & {+ tag: "h1" | "h2" | "h3" | "h4" | "h5" | "h6";+};++export const Heading = forwardRef<ElementRef<typeof defaultTag>, Props>(+ (props, ref) => {+ const H = props.tag;+ return <H {...props} ref={ref} />;+ }+);++Heading.defaultProps = {+ tag: "h1",+};Heading.displayName = "Heading";