Skip to contents

Sets the defaults that withBones() uses for the rest of the session. An argument that is NULL does not change its default. An argument that you give to withBones() is stronger than a default from here.

Usage

bones_defaults(
  animation = NULL,
  color = NULL,
  highlight = NULL,
  radius = NULL,
  speed = NULL,
  stale = NULL,
  delay = NULL,
  min_time = NULL,
  remember = NULL
)

Arguments

animation

How the placeholder moves:

  • "wave": a band of light moves along each bar.

  • "pulse": the whole placeholder fades out and in.

  • "cascade": each bar, cell or line lights up a little after the one before, so a ripple runs through the shape.

  • "sweep": one band of light crosses the whole placeholder, over every mark at once, the lines and dots of a chart too.

  • "none": no movement.

Users who ask their system to reduce motion always get "none".

color

The colour of the placeholder, as a CSS colour. By default it comes from the theme of the page: the text colour of the bslib theme, made faint. A colour given here is stronger than the theme.

highlight

The colour of the band of light in the "wave" animation, and of the header row of a table. By default it comes from the theme, as color does.

radius

The CSS corner radius of the placeholder bars. By default it follows the rounding of the theme.

speed

The time of one animation cycle, in seconds.

stale

The default for the stale argument of withBones().

delay, min_time

The defaults for the delay and min_time arguments of withBones(), in milliseconds.

remember

The default for the remember argument of withBones().

Value

The old values, invisibly, in the form that options() uses. Give them to options() to restore them. Do not give them to bones_defaults(): NULL there means "do not change", so an option that had no value before would keep the new value.

Examples

old <- bones_defaults(animation = "pulse", radius = "0.5rem")
bones_skeleton("text")
#> <div class="bones-skeleton bones-skeleton-text bones-anim-pulse" aria-hidden="true" style="height: 72px; --bones-radius: 0.5rem;">
#>   <div class="bones-bar" style="width: 100%;"></div>
#>   <div class="bones-bar" style="width: 94%;"></div>
#>   <div class="bones-bar" style="width: 62%;"></div>
#> </div>

options(old)