Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance checkbox customizability #728

Merged

Conversation

anishsinha-io
Copy link
Contributor

The Checkbox component now offers a greater degree of customizability over the appearance of the checked state. Previously, the checkmark was not customizable. Now, users may provide their own SVGs if they wish. No existing APIs were broken, but a few new ones were added, namely there's now a custom_ prefixed static method for each existing method. Also, two new convenience functions, custom_checkbox and custom_labeled_checkbox are available. The default checkbox SVG is now made available to users if they want to use it elsewhere, for example in a different component (previously it was a function-local const, now it's a pub const).

The checkbox example in the widget-gallery has been enhanced with two additional examples showcasing some of the new behavior. I've attached a screenshot of the new functionality below.

image

The `Checkbox` component now offers a greater degree of customizability
over the appearance of the `checked` state. Previously, the checkmark
was not customizable. Now, users may provide their own SVGs if they
wish. No existing APIs were broken, but a few new ones were added,
namely there's now a `custom_` prefixed static method for each existing
method. Also, two new convenience functions, `custom_checkbox` and
`custom_labeled_checkboxes` are available. The default checkbox SVG is
now made available to users if they want to use it elsewhere, for
example in a different component (previously it was a function-local
`const`, now it's a `pub const`.

The `checkbox` example in the `widget-gallery` has been enhanced with
two additional examples showcasing some of the new behavior.
Copy link
Collaborator

@jrmoulton jrmoulton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Just a few suggestions on the docs.

Thanks for the PR!

src/views/checkbox.rs Outdated Show resolved Hide resolved
src/views/checkbox.rs Outdated Show resolved Hide resolved
src/views/checkbox.rs Outdated Show resolved Hide resolved
src/views/checkbox.rs Outdated Show resolved Hide resolved
src/views/checkbox.rs Outdated Show resolved Hide resolved
src/views/checkbox.rs Outdated Show resolved Hide resolved
Apply the suggestions for the documentation of the `custom_` prefixed
methods and helpers.
@jrmoulton jrmoulton merged commit be07520 into lapce:main Jan 9, 2025
7 checks passed
@jrmoulton
Copy link
Collaborator

Thanks!

@anishsinha-io anishsinha-io deleted the enhance-checkbox-customizability branch January 11, 2025 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants