R/wa_intersection_observer.R

Defines functions wa_intersection_observer

Documented in wa_intersection_observer

# Generated by tools/generate_components.R. Do not edit by hand.
# nolint start: object_usage_linter.

#' Create a `wa-intersection-observer` component
#'
#' Generated wrapper for the Web Awesome `wa-intersection-observer`
#' component.
#' Generated from Web Awesome metadata.
#'
#' @param ... Child content for the component's default slot.
#' @param id Optional DOM id attribute for HTML, CSS, and JS targeting.
#' @param class Optional CSS class string.
#' @param style Optional inline CSS style string.
#' @param disabled Boolean. Default: `FALSE`. Deactivates the intersection
#' observer functionality.
#' @param dir String. Optional Web Awesome attribute.
#' @param intersect_class String. Default: `""`. CSS class applied to
#' elements during intersection. Automatically removed when elements leave
#' the viewport, enabling pure CSS styling based on visibility state.
#' @param lang String. Optional Web Awesome attribute.
#' @param once Boolean. Default: `FALSE`. If enabled, observation ceases
#' after initial intersection.
#' @param root String. Default: `null`. Element ID to define the viewport
#' boundaries for tracked targets.
#' @param root_margin String. Default: `0px`. Offset space around the root
#' boundary. Accepts values like CSS margin syntax.
#' @param threshold String. Default: `0`. One or more space-separated
#' values representing visibility percentages that trigger the observer
#' callback.
#'
#' @section Shiny Bindings:
#' None.
#'
#' @return An HTML tag for the component.
#'
#' @export
wa_intersection_observer <- function(
  ...,
  id = NULL,
  class = NULL,
  style = NULL,
  disabled = NULL,
  dir = NULL,
  intersect_class = NULL,
  lang = NULL,
  once = NULL,
  root = NULL,
  root_margin = NULL,
  threshold = NULL
) {
  children <- list(...)

  attrs <- .wa_normalize_attrs(
    list(
      "id" = id,
      "class" = class,
      "style" = style,
      "disabled" = disabled,
      "dir" = dir,
      "intersect-class" = intersect_class,
      "lang" = lang,
      "once" = once,
      "root" = root,
      "root-margin" = root_margin,
      "threshold" = threshold
    ),
    boolean_names = c("disabled", "once"),
    boolean_arg_names = c(
      "disabled" = "disabled",
      "once" = "once"
    )
  )

  do.call(
    .wa_component,
    c(
      list("wa-intersection-observer", .attrs = attrs),
      children
    )
  )
}
# nolint end

Try the shiny.webawesome package in your browser

Any scripts or data that you put into this service are public.

shiny.webawesome documentation built on April 22, 2026, 1:09 a.m.