diff --git a/apps/docs/src/pages/components/_meta.ts b/apps/docs/src/pages/components/_meta.ts index 37605a4362..2906fa9fd2 100644 --- a/apps/docs/src/pages/components/_meta.ts +++ b/apps/docs/src/pages/components/_meta.ts @@ -13,6 +13,7 @@ export default { input: "Input", loading: "Loading", loadingContainer: "LoadingContainer", + section: "Section", tag: "Tag", textarea: "TextArea", }; diff --git a/apps/docs/src/pages/components/section.mdx b/apps/docs/src/pages/components/section.mdx new file mode 100644 index 0000000000..c367f0188c --- /dev/null +++ b/apps/docs/src/pages/components/section.mdx @@ -0,0 +1,94 @@ +import { + HvActionsGeneric, + HvSection, + sectionClasses, +} from "@hitachivantara/uikit-react-core"; + +import { Description } from "@docs/components/component/Description"; +import { Page } from "@docs/components/component/Page"; + +import Playground from "./Playground"; + +import { getComponentData } from "../../utils/utils"; + +export const getStaticProps = async ({ params }) => { + const meta = await getComponentData("Section", "core", sectionClasses); + return { props: { ssg: { meta: meta } } }; +}; + + + + + + +

My section example content

+ + } +/> + +### Actions + +You can add actions to the section header by using the `actions` prop which can accept any component. + +```jsx live +Explore Insights} + title={ + Unlock the Power of Your Data + } +> + + Discover actionable insights hidden within your data. With our advanced + tools and intuitive dashboards, transform raw numbers into meaningful + strategies that drive success. + + +``` + +### Controlled + +You can control the state of `HvSection` by using the `expanded / onToggle` props. + +```tsx live +import { useState } from "react"; + +export default function Demo() { + const [expanded, setExpanded] = useState(false); + + return ( +
+ setExpanded((p) => !p)}> + Expand + + setExpanded((p) => !p)} + > + + This section is controlled by the state of the parent component. + + +
+ ); +} +``` + +