% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ports.R
\name{g6_port}
\alias{g6_port}
\alias{g6_input_port}
\alias{g6_output_port}
\title{Create a G6 Port}
\usage{
g6_port(
  key,
  label = key,
  type = c("input", "output"),
  arity = 1,
  visibility = c("visible", "hover", "hidden"),
  ...
)

g6_input_port(
  key,
  label = key,
  arity = 1,
  visibility = c("visible", "hover", "hidden"),
  fill = "#52C41A",
  ...
)

g6_output_port(
  key,
  label = key,
  arity = 1,
  visibility = c("visible", "hover", "hidden"),
  fill = "#FF4D4F",
  ...
)
}
\arguments{
\item{key}{Character. Unique identifier for the port (required).}

\item{label}{Character. Label text for the port (optional).}

\item{type}{Character. Either "input" or "output" (required).}

\item{arity}{Numeric. Maximum number of
connections this port can accept (default: 1).
Use 0, Inf, or any non-negative integer.}

\item{visibility}{Character. Controls port visibility behavior:
\itemize{
\item \code{"visible"}: Ports are always shown (default).
\item \code{"hover"}: Ports appear only when hovering over the node.
\item \code{"hidden"}: Ports are never visible.
}}

\item{...}{Additional port style parameters, e.g. \code{placement} and
\code{r} (radius, default 6). See
\url{https://g6.antv.antgroup.com/en/manual/element/node/base-node#portstyleprops}.
In addition to G6's native placements (\code{"left"}, \code{"right"},
\code{"top"}, \code{"bottom"}, or a \code{c(x, y)} pair), g6R adds
\code{placement = "label-bottom"}: the port snaps to the bottom-centre of the
node's label background when the node has a bottom label, falling back to a
normal bottom-of-node port otherwise. Pass \code{ripple = FALSE} to disable
the hover ripple for a port, or \code{haloFill} to override the colour of the
ring that makes the port look set into the node surface.}

\item{fill}{Character. Color of the port
(default: "#52C41A" for input ports,
"#FF4D4F" for output ports).}
}
\value{
An S3 object of class 'g6_port'.
}
\description{
Create a G6 Port

Create a single-connection input port

Create an output port (single connection by default)
}
\note{
To create an (input/output) port with multiple connections,
simply set the arity to \code{Inf} or any positive integer.
}
\examples{
g6_port("input-1", label = "port 1", type = "input", arity = 2, placement = "left")
g6_port("output-1", label = "port 2", type = "output", placement = "right")
g6_port("input-2", type = "input", visibility = "hover")
}
