% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/boxGrobs_boxHeaderGrob.R
\name{boxHeaderGrob}
\alias{boxHeaderGrob}
\title{Create a composite box with header and body text}
\usage{
boxHeaderGrob(
  header,
  body,
  y = unit(0.5, "npc"),
  x = unit(0.5, "npc"),
  width,
  height,
  bjust = "center",
  header_gp = getOption("boxHeaderGrobTxt", default = gpar(color = "black", cex = 1)),
  body_gp = getOption("boxBodyGrobTxt", default = gpar(color = "black", cex = 0.9)),
  box_gp = getOption("boxGrob", default = gpar(fill = "white")),
  box_fn = roundrectGrob,
  name = NULL
)
}
\arguments{
\item{header}{The header text (centered, typically bold).}

\item{body}{The body text (left-justified, typically with bullets or multiple lines).}

\item{y}{The y position to put the box at. Can be either in \code{npc} (i.e. 0-1) or a \code{\link[grid]{unit}}.}

\item{x}{The x position to put the box at. Can be either in \code{npc} (i.e. 0-1) or a \code{\link[grid]{unit}}.}

\item{width}{The box automatically adapts the size but you can force by specifying the width}

\item{height}{The box automatically adapts the size but you can force by specifying the height}

\item{bjust}{The justification for the box: left, center, right, top or bottom.
See the \code{just} option for the \code{\link[grid]{viewport}}}

\item{header_gp}{The \code{\link[grid]{gpar}} style to apply to the header text.
Defaults to bold text at slightly larger size.}

\item{body_gp}{The \code{\link[grid]{gpar}} style to apply to the body text.}

\item{box_gp}{The \code{\link[grid]{gpar}} style to apply to the box function of `box_fn` below.}

\item{box_fn}{Function to create box for the text. Parameters of `x=0.5`, `y=0.5` and `box_gp` will
be passed to this function and return a \code{grob} object.}

\item{name}{a character identifier for the \code{grob}. Used to find the \code{grob} on the display
list and/or as a child of another grob.}
}
\value{
A grob with class "box" compatible with all Gmisc flowchart helpers
 (\code{\link{coords}}, \code{\link{distance}}, \code{\link{connectGrob}},
 \code{\link{spreadVertical}}, \code{\link{alignHorizontal}}, etc.)
}
\description{
Creates a \code{\link[grid:grid.grob]{grob}} box with a centered header and
left-justified body text. Useful for flowchart elements that combine a title
with bullet points or multi-line descriptions.
}
\examples{
library(grid)
grid.newpage()

# Simple example with header and bullets
box1 <- boxHeaderGrob(
  header = "Early rehabilitation",
  body = paste("0-1 weeks", "• Instruction", "• Pendulum + assisted ROM", sep = "\n"),
  header_gp = gpar(fontsize = 11, fontface = "bold"),
  body_gp = gpar(fontsize = 9),
  box_gp = gpar(fill = "#E8F5E9", col = "#2E7D32")
)
grid.draw(box1)

# Works with all helpers
box2 <- boxHeaderGrob(
  header = "Delayed rehabilitation",
  body = "0-3 weeks\n• Sling immobilisation",
  y = 0.3,
  box_gp = gpar(fill = "#FFF8E1", col = "#EF6C00")
)

# Distance calculation works
d <- distance(box1, box2, type = "v")

# Connect boxes
grid.draw(box2)
connectGrob(box1, box2, type = "vertical")
}
\seealso{
Other flowchart components:
\code{\link[=align]{align()}},
\code{\link[=append]{append()}},
\code{\link[=boxGrob]{boxGrob()}},
\code{\link[=boxPropGrob]{boxPropGrob()}},
\code{\link{boxShapes}},
\code{\link[=connectGrob]{connectGrob()}},
\code{\link[=coords]{coords()}},
\code{\link[=distance]{distance()}},
\code{\link[=equalizeWidths]{equalizeWidths()}},
\code{\link[=flowchart]{flowchart()}},
\code{\link[=insert]{insert()}},
\code{\link[=move]{move()}},
\code{\link[=moveBox]{moveBox()}},
\code{\link[=spread]{spread()}}
}
\concept{flowchart components}
