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

Add missing props #478

Merged
merged 7 commits into from
Jan 22, 2025
Merged

Add missing props #478

merged 7 commits into from
Jan 22, 2025

Conversation

AnnMarieW
Copy link
Collaborator

@AnnMarieW AnnMarieW commented Jan 11, 2025

closes #428

open items for # 428

@AnnMarieW
Copy link
Collaborator Author

AnnMarieW commented Jan 11, 2025

Here are the examples from the docs

1. dmc.Center(inline=True) Makes it easy to align icons and text

image

import dash_mantine_components as dmc
from dash import Dash, _dash_renderer
from dash_iconify import DashIconify
_dash_renderer._set_react_version("18.2.0")

app = Dash(external_stylesheets=dmc.styles.ALL)

component = dmc.Box(
    dmc.Anchor(
        href="https://mantine.dev",
        target="_blank",
        children=dmc.Center(
            [
                DashIconify(
                    icon="tabler:arrow-left",  # Use the Tabler Arrow Left icon
                    width=12,
                    height=12,
                ),
                dmc.Box("Back to Mantine website", ml=5),
            ],
            inline=True,
        ),
    )
)

app.layout = dmc.MantineProvider(
    component
)

if __name__ == "__main__":
    app.run(debug=True, port=8052)

2. dmc.Avatar(allowedInitialsColors=["blue", "red"]) Can limit the number of colors to use in Avatar initials

image

import dash_mantine_components as dmc
from dash import Dash, _dash_renderer
_dash_renderer._set_react_version("18.2.0")

app = Dash(external_stylesheets=dmc.styles.ALL)
names = [
  'John Doe',
  'Jane Mol',
  'Alex Lump',
  'Sarah Condor',
  'Mike Johnson',
  'Kate Kok',
  'Tom Smith',
]

component = dmc.Group(
    [dmc.Avatar(name=n, color="initials", allowedInitialsColors=["blue", "red"]) for n in names]
)

app.layout = dmc.MantineProvider(
    component
)

if __name__ == "__main__":
    app.run(debug=True, port=8052)

@AnnMarieW AnnMarieW mentioned this pull request Jan 21, 2025
12 tasks
@AnnMarieW
Copy link
Collaborator Author

AnnMarieW commented Jan 21, 2025

  1. Added defaultExpanded prop to `CodeHighlightTabs component. Gives ability to set initial expanded state when the the expand/collapse feature is enabled.

codehighlightabs

import dash_mantine_components as dmc
from dash_iconify import DashIconify

from dash import Dash, _dash_renderer
_dash_renderer._set_react_version("18.2.0")

app = Dash(external_stylesheets=dmc.styles.ALL)


styles_css = """
.dmc-api-demo-root {
  border: 1px solid light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-4));
  padding: var(--mantine-spacing-xs) var(--mantine-spacing-sm);
  border-radius: var(--mantine-radius-md);
  font-weight: 500;
  cursor: pointer;

  &[data-checked] {
    background-color: var(--mantine-color-blue-filled);
    border-color: var(--mantine-color-blue-filled);
    color: var(--mantine-color-white);
  }
}"""

demo_py = """
import dash_mantine_components as dmc

 dmc.Checkbox(
    classNames={"root": "dmc-api-demo-root"},
    label="Checkbox button",
    w=180
)"""


code = [
    {
        "fileName": "demo.py",
        "code": demo_py,
        "language": "python",
        "icon": DashIconify(icon="vscode-icons:file-type-reactts", width=20),
    },
    {
        "fileName": "styles.css",
        "code":styles_css,
        "language": "css",
        "icon": DashIconify(icon="vscode-icons:file-type-css", width=20),
    },
]

component = dmc.CodeHighlightTabs(
    code=code,
    withExpandButton=True,
    expandCodeLabel="Show full code",
    collapseCodeLabel="Show less",
    defaultExpanded=False,
    maxCollapsedHeight=300
)


app.layout = dmc.MantineProvider(
    component,
    forceColorScheme="light"
)

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

@AnnMarieW
Copy link
Collaborator Author

Added autoComplete prop to PasswordInput

image

import dash_mantine_components as dmc
from dash import Dash, _dash_renderer, Input, Output, State
_dash_renderer._set_react_version("18.2.0")

app = Dash(external_stylesheets=dmc.styles.ALL)


app.layout = dmc.MantineProvider(
     dmc.PasswordInput(autoComplete="new-password")    
)

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

@AnnMarieW AnnMarieW merged commit bc3cb28 into snehilvj:master Jan 22, 2025
1 check passed
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.

Add missing props
1 participant