githubEdit

Row

A row is a container for items.

The timeline is constructed of many rows, stacked on top of each other, where each row contains all the items related to it.

circle-info

Row is an extension of dnd-kits's Droppablearrow-up-right.

Please make sure you unserstand it's basic concepts before moving on.

dnd-timeline does not provide you with a <Row /> component, so you will need to build your own.

A basic Row component will look like this:

Row.tsx
interface RowProps extends RowDefinition {
  children: React.ReactNode
  sidebar: React.ReactNode
}

function Row(props: RowProps) {
  const {
    setNodeRef,
    setSidebarRef,
    rowWrapperStyle,
    rowStyle,
    rowSidebarStyle,
  } = useRow({ id: props.id })

  return (
    <div style={rowWrapperStyle}>
      <div ref={setSidebarRef} style={rowSidebarStyle}>
        {props.sidebar}
      </div>
      <div ref={setNodeRef} style={rowStyle}>
        {props.children}
      </div>
    </div>
  )
}

dnd-timeline also provides you with a helper type that you can extend.

You can fully customize this component according to your needs.

Usage

Every <Row /> component should be rendered as a child of it's parent row.

Last updated