rstudio / rstudio/bslib

Add an `inline` option to input_switch()

Open
#1,128 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
SCSS
Stars
569
Forks
72
Avg merge
1d 2h
Merged PRs (30d)
5

Description

I'd like to make a switch input that has labels on both the left and right sides. The most straightforward way I can think of to try to do this would be to put some manual spans on the left or right on the same line. But the switch input is wrapped in a div, which makes it always appear on its own line.

It looks from the source code like the internal function actually has an inline parameter, so I suggest just exposing it in input_switch() (unless there's a reason that'd break things):

https://github.com/rstudio/bslib/blob/85b042832e1520b5f06dc95c769396816be76eca/R/input-switch.R#L83C100-L83C114

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in R/input-switch.R at the linked input_switch() definition and inspect how its internal inline parameter is handled. Expose that option through input_switch(), then verify that the switch can render on the same line so labels can be placed on both sides.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
frontend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.