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

Common style property underline, underline focused and underline disa… #451

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,41 @@ <h3>Inputs can have custom logic</h3>
</paper-input-container>
</template>
</demo-snippet>

<h3>You can style a paper-input using custom properties</h3>
<demo-snippet>
<template>
<style is="custom-style">
paper-input.custom {
--paper-input-container-underline-common: {
display: none;
};

--paper-input-container-label: {
color: var(--paper-pink-500);
font-style: italic;
font-weight: bold;
}
}

paper-input.custom-focus {
--paper-input-container-underline-common: {
display: none;
background: #737373;
height: 1px;
};

--paper-input-container-underline-focus: {
display: inline;
background: #E91E63;
height: 2px;
};
}
</style>
<paper-input class="custom" label="Custom style"></paper-input>
<paper-input class="custom-focus" label="Overriden common underline style for focus"></paper-input>
</template>
</demo-snippet>
</div>

<script>
Expand Down
4 changes: 4 additions & 0 deletions paper-input-container.html
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
`--paper-input-container-label-focus` | Mixin applied to the label when the input is focused | `{}`
`--paper-input-container-label-floating` | Mixin applied to the label when floating | `{}`
`--paper-input-container-input` | Mixin applied to the input | `{}`
`--paper-input-container-underline-common` | Mixin applied to the underline when the input is not focused, focused or disabled | `{}`
`--paper-input-container-input-focus` | Mixin applied to the input when focused | `{}`
`--paper-input-container-input-invalid` | Mixin applied to the input when invalid | `{}`
`--paper-input-container-input-webkit-spinner` | Mixin applied to the webkit spinner | `{}`
Expand Down Expand Up @@ -149,6 +150,7 @@
-webkit-transform: scale3d(0,1,1);
transform: scale3d(0,1,1);

@apply(--paper-input-container-underline-common);
@apply(--paper-input-container-underline-focus);
}

Expand Down Expand Up @@ -176,13 +178,15 @@

border-bottom: 1px solid var(--paper-input-container-color, --secondary-text-color);

@apply(--paper-input-container-underline-common);
@apply(--paper-input-container-underline);
}

:host([disabled]) .unfocused-line {
border-bottom: 1px dashed;
border-color: var(--paper-input-container-color, --secondary-text-color);

@apply(--paper-input-container-underline-common);
@apply(--paper-input-container-underline-disabled);
}

Expand Down