Skip to content

[bug]: ui.input_select() and ui.input_selectize()'s interfaces should be de-coupled #1687

@schloerke

Description

@schloerke

Currently, ui.input_select() is a base function for ui.input_selectize().

This requires that ui.input_select() have extra arguments:

  • selectize:bool = False; Enables selectize.js
  • remove_button: Optional[bool] = None; Adds remove button plugin for selectize.js
  • options: Optional[dict[str, Jsonifiable | JSEval]] = None; Options supplied to selectize.js

In addition, ui.input_select(choices=) has type support for HTML tags. While it currently doesn't throw an error, I believe a type error should be displayed.

Ex:

ui.input_select( 
	"basic_select2",
	"Default select",
	{
		"a": "Choice A",
		"b": ui.tags.div(ui.tags.strong("Choice B1"), ui.tags.strong("Choice B2")),
	},
)

This is displays as if the second choice has a value of " Choice B1AChoice B2 ", not the HTML tags that is represents.


Proposal:

  • Move the current definition of ui.input_select() to input_select_impl(). Have both ui.input_select() and ui.input_selectize() call input_select_impl() directly.
  • Deprecate and eventually remove selectize=, remove_button=, and options= from input_select().
  • Create separate typing for input_select(choices=) where the eventual type definition of _Choices = Mapping[str, TagChild] becomes Mapping[str, str]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions