% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/boxGrobs_equalizeWidths.R
\name{equalizeWidths}
\alias{equalizeWidths}
\title{Equalize box widths}
\usage{
equalizeWidths(x, subelement = NULL, width = NULL)
}
\arguments{
\item{x}{A list of boxes (or nested lists of boxes). Can also be a single box.}

\item{subelement}{Optional target(s) inside \code{x}.
Can be a single path (e.g. \code{c("groups", 1)}) or a list of paths
(e.g. \code{list(c("groups", 1), c("groups2", 1))}).
If \code{NULL}, all top-level boxes in \code{x} are used.}

\item{width}{Optional width to apply. If \code{NULL}, the maximum current width
among selected boxes is used.}
}
\value{
The updated object with equalized widths.
}
\description{
Sets selected boxes to a shared width. This is useful when aligning flowchart
levels so corresponding boxes have consistent visual width and center points.
}
\examples{
fc <- flowchart(
  groups = list("Group 1", "Group 2"),
  groups2 = list("Analysed", "Analysed")
)

fc |>
  equalizeWidths(subelement = list(c("groups", 1),
                                   c("groups2", 1),
                                   c("groups", 2),
                                   c("groups2", 2)))

# Global fixed width via explicit argument
fc |> equalizeWidths(subelement = "groups", width = grid::unit(30, "mm"))
}
\seealso{
Other flowchart components:
\code{\link[=align]{align()}},
\code{\link[=append]{append()}},
\code{\link[=boxGrob]{boxGrob()}},
\code{\link[=boxHeaderGrob]{boxHeaderGrob()}},
\code{\link[=boxPropGrob]{boxPropGrob()}},
\code{\link{boxShapes}},
\code{\link[=connectGrob]{connectGrob()}},
\code{\link[=coords]{coords()}},
\code{\link[=distance]{distance()}},
\code{\link[=flowchart]{flowchart()}},
\code{\link[=insert]{insert()}},
\code{\link[=move]{move()}},
\code{\link[=moveBox]{moveBox()}},
\code{\link[=spread]{spread()}}
}
\concept{flowchart components}
