diff --git a/site/src/components/docs/api-reference/ApiPropsTable.astro b/site/src/components/docs/api-reference/ApiPropsTable.astro index aa2c7080..e4137a73 100644 --- a/site/src/components/docs/api-reference/ApiPropsTable.astro +++ b/site/src/components/docs/api-reference/ApiPropsTable.astro @@ -15,9 +15,10 @@ import PropRow from './PropRow.astro'; interface Props { props: Record; componentName: string; + showAttributeName?: boolean; } -const { props, componentName } = Astro.props; +const { props, componentName, showAttributeName } = Astro.props; --- @@ -39,6 +40,7 @@ const { props, componentName } = Astro.props; description={prop.description} defaultValue={prop.default} required={prop.required} + showAttributeName={showAttributeName} componentName={componentName} /> )) diff --git a/site/src/components/docs/api-reference/ComponentReference.astro b/site/src/components/docs/api-reference/ComponentReference.astro index 156638f2..b9f90aa1 100644 --- a/site/src/components/docs/api-reference/ComponentReference.astro +++ b/site/src/components/docs/api-reference/ComponentReference.astro @@ -33,6 +33,7 @@ if (!apiRef) return; const apiReferenceModel = createComponentReferenceModel(component, apiRef); if (!apiReferenceModel) return; +const showAttributeName = framework === 'html'; const singlePropsSection = !apiReferenceModel.hasParts ? apiReferenceModel.sections.find((section) => section.key === 'props') @@ -90,6 +91,7 @@ const singleCssCustomPropertiesSection = !apiReferenceModel.hasParts )} @@ -149,6 +151,7 @@ const singleCssCustomPropertiesSection = !apiReferenceModel.hasParts )} diff --git a/site/src/components/docs/api-reference/DetailRow.astro b/site/src/components/docs/api-reference/DetailRow.astro index 55f2609f..bab8d8c0 100644 --- a/site/src/components/docs/api-reference/DetailRow.astro +++ b/site/src/components/docs/api-reference/DetailRow.astro @@ -19,14 +19,15 @@ interface Props { id: string; name: string; type: string; + attributeName?: string; detailedType?: string; description?: string; colspan: number; } -const { id, name, type, detailedType, description, colspan } = Astro.props; +const { id, name, type, attributeName, detailedType, description, colspan } = Astro.props; -const hasDetail = Boolean(detailedType || description); +const hasDetail = Boolean(attributeName || detailedType || description); --- + {attributeName && ( + <> +
Attribute
+
+ {attributeName} +
+ + )} + {description && ( <>
Description
diff --git a/site/src/components/docs/api-reference/PropRow.astro b/site/src/components/docs/api-reference/PropRow.astro index c5161b04..e4a5c5d0 100644 --- a/site/src/components/docs/api-reference/PropRow.astro +++ b/site/src/components/docs/api-reference/PropRow.astro @@ -1,4 +1,5 @@ --- +import { kebabCase } from 'es-toolkit/string'; import MarkdownCode from '@/components/typography/MarkdownCode.astro'; import Td from '@/components/typography/Td.astro'; import DetailRow from './DetailRow.astro'; @@ -10,18 +11,21 @@ interface Props { description?: string; defaultValue?: string; required?: boolean; + showAttributeName?: boolean; componentName: string; } -const { name, type, detailedType, description, defaultValue, required, componentName } = Astro.props; +const { name, type, detailedType, description, defaultValue, required, showAttributeName, componentName } = Astro.props; const id = `${componentName}-${name}`; +const attributeName = showAttributeName ? kebabCase(name) : undefined; ---