Search the documentation

Type to search page titles, component names and descriptions.

    Develop

    Using React

    Server rendering, hydration and DOM interactions with Faifo Design in React.

    Install Faifo Design alongside React and React DOM. The React entry supports React and React DOM ^19.2.0.

    npm install faifo-design react@^19.2.0 react-dom@^19.2.0

    Import markup components from faifo-design/react. Load the stylesheet once and set data-faifo-design on the application root.

    import { Button, Field, Stack } from 'faifo-design/react'
    import 'faifo-design/styles.css'
    
    export function ProjectForm() {
      return (
        <main data-faifo-design>
          <form action="/projects" method="post">
            <Stack
              items={[
                <Field key="name" id="project-name" name="name" label="Name" required />,
                <Button key="submit" type="submit" label="Save project" />,
              ]}
            />
          </form>
        </main>
      )
    }

    The React entry accepts React nodes for component slots. Give changing lists stable React keys. Form values and checked states supplied to Faifo components are initial values. Native controls and browser form submission own subsequent edits. The React markup entry omits ketjs-view island controllers.

    The React entry exports markup components. For string helpers, import qrSvg and searchFilterRuleLabel from faifo-design/html. Use a React fragment to group React nodes.

    Use your framework's server renderer and hydration entry points. Attach the same DOM interaction runtime after hydration commits. An effect in the React root can attach it and return its cleanup function.

    import { useEffect } from 'react'
    import { attachDesignSystemInteractions } from 'faifo-design/runtime'
    
    export function FaifoInteractions() {
      useEffect(() => attachDesignSystemInteractions(document), [])
      return null
    }

    Mount this component once. Keep the server and client props equivalent at the hydration boundary.