Skip to content

Style parameter for form buttons #6713

@mo-rn

Description

@mo-rn

Description

One of my coworkers is colorblind, and has trouble recognizing button state by its pale yellow vs light grey colors.

Alas, we can't style the submit button on a form, because the properties passed to a style method are applied to an outer div and then overridden by generated code.

Example:

import marimo

__generated_with = "0.16.4"
app = marimo.App(width="medium")


@app.cell
def _():
    import marimo as mo

    return (mo,)


@app.cell
def _(mo):
    form = mo.ui.text_area(placeholder="...").form()

    return (form,)


@app.cell
def _(form, mo):
    mo.vstack([form.style({'--action': '#ffdf13', '--action-hover': '#ffdf13aa'}), mo.md(f"Has value: {form.value}")])

    return


if __name__ == "__main__":
    app.run()

It only works when I use developer tools to disable the button styles, allowing the outer div styles to be applied:
Image

I have no programmatic way to do this within Marimo!

Suggested solution

I would like to be able to pass button styles into the form constructor.

Are you willing to submit a PR?

  • Yes

Alternatives

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions