position_centered: Centering positioned elements

View source: R/position-centered.R

position_centeredR Documentation

Centering positioned elements

Description

Use position_centered() to position an element by its center instead of its edge.

Usage

position_centered(x)

Arguments

x

A tag element or .style pronoun.

Value

An object of the same type as x.

See Also

Other position utilities: position_sticky(), position()

Examples


library(htmltools)

div(
  .style %>%
    position("absolute") %>%
    position_right(0) %>%
    position_centered()
)

tags$button(
  type = "button",
  .style %>%
    position("relative") %>%
    background_color(theme_primary()),
  "Mail",
  span(
    .style %>%
      position("absolute") %>%
      position_top(0) %>%
      position_right(0) %>%
      position_centered() %>%
      rounded_all("pill") %>%
      background_color(theme_secondary()),
    "+99"
  )
)


cascadess documentation built on Oct. 30, 2024, 9:29 a.m.