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 label_style modifier #777

Closed
wants to merge 9 commits into from
Closed

Add label_style modifier #777

wants to merge 9 commits into from

Conversation

carson-katri
Copy link
Contributor

@carson-katri carson-katri commented Apr 6, 2023

Closes #478

This sets up a solution for creating custom styles purely on the Elixir side.

The custom elements <icon /> and <title /> can be used within the <label_style:custom_style>, and provide access to the content of the label they represent. Then this style can quickly be applied to all labels within the <VStack>.

<VStack modifiers={label_style(@native, style: :custom_style)}>
    <Label system-image="hand.raised.fill">Greet</Label>
    <Label system-image="eraser.line.dashed.fill">Erase</Label>
    <Label system-image="lasso.and.sparkles">Wrangle</Label>

    <%!-- Create the custom style, which is applied to all 3 labels --%>

    <label_style:custom_style>
        <Grid modifiers={padding(@native, all: 8)}>
            <GridRow>
                <Text>Icon</Text>
                <Text>Title</Text>
            </GridRow>
            <GridRow modifiers={foreground_style(@native, primary: {:color, :green})}>
                <%!-- These elements are only valid within this style block. --%>
                <icon />
                <title />
            </GridRow>
        </Grid>
    </label_style:custom_style>
</VStack>

@bcardarella
Copy link
Collaborator

can you change label_style to label-style instead? We want to conform to hyphenation within the markup

@bcardarella
Copy link
Collaborator

oh it is linking back to the label_style modifier... let's discuss this on standup. Having underscored elements is going to throw people off

Base automatically changed from background-modifier to main April 14, 2023 03:02
@carson-katri carson-katri deleted the label-style-modifier branch June 1, 2023 14:54
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.

None yet

3 participants