material-web/demos/textfield.html
2019-08-16 18:49:40 -07:00

98 lines
3.8 KiB
HTML

<!doctype html>
<!--
@license
Copyright 2018 Google Inc. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<html>
<head>
<title>textfield demo</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="../node_modules/@webcomponents/webcomponentsjs/webcomponents-bundle.js"></script>
<script type="module" src="../node_modules/@material/mwc-textfield/mwc-textfield.js"></script>
<script type="module" src="../node_modules/@material/mwc-icon/mwc-icon.js"></script>
<script type="module" src="../node_modules/@material/mwc-icon/mwc-icon-font.js"></script>
<link rel="stylesheet" href="demo-component.css">
<style>
mwc-textfield {
min-width: 240px;
}
.shaped-filled {
--mdc-text-field-filled-border-radius: 32px 32px 0 0;
}
.shaped-outlined {
--mdc-notched-outline-leading-width: 28px;
--mdc-notched-outline-leading-border-radius: 28px 0 0 28px;
--mdc-notched-outline-trailing-border-radius: 0 28px 28px 0;
}
</style>
</head>
<body class="unresolved">
<header>
<a href="index.html"><mwc-icon>arrow_back</mwc-icon>
<span>Text Field</span></a>
</header>
<main>
<h4>Filled</h4>
<div class="demo-group-spaced">
<mwc-textfield label="Standard"></mwc-textfield>
<mwc-textfield label="Standard" icon="event"></mwc-textfield>
<mwc-textfield label="Standard" iconTrailing="delete"></mwc-textfield>
</div>
<h4>Shaped Filled</h4>
<div class="demo-group-spaced shaped-filled">
<mwc-textfield label="Standard"></mwc-textfield>
<mwc-textfield label="Standard" icon="event"></mwc-textfield>
<mwc-textfield class="color" label="Standard" iconTrailing="delete"></mwc-textfield>
</div>
<h4>Outlined</h4>
<div class="demo-group-spaced">
<mwc-textfield outlined label="Standard"></mwc-textfield>
<mwc-textfield outlined label="Standard" icon="event"></mwc-textfield>
<mwc-textfield outlined label="Standard" iconTrailing="delete"></mwc-textfield>
</div>
<h4>Shaped Outlined</h4>
<div class="demo-group-spaced shaped-outlined">
<mwc-textfield outlined label="Email" type="email"></mwc-textfield>
<mwc-textfield outlined label="Standard" icon="event"></mwc-textfield>
<mwc-textfield outlined label="Standard" iconTrailing="delete"></mwc-textfield>
</div>
<h4>Text Field without label</h4>
<div class="demo-group-spaced">
<mwc-textfield helper="Helper Text"></mwc-textfield>
<mwc-textfield outlined helper="Helper Text"></mwc-textfield>
<mwc-textfield outlined helper="Helper Text" class="shaped-outlined"></mwc-textfield>
</div>
<h4>Text Field with Character Counter</h4>
<div class="demo-group-spaced">
<mwc-textfield label="Standard" helper="Helper Text" helperPersistent maxlength="18" charCounter></mwc-textfield>
<mwc-textfield outlined label="Standard" helper="Helper Text" helperPersistent maxlength="18" charCounter></mwc-textfield>
<mwc-textfield outlined label="Standard" helper="Helper Text" helperPersistent maxlength="18" charCounter class="shaped-outlined"></mwc-textfield>
</div>
<h4>Full Width</h4>
<mwc-textfield fullwidth placeholder="Standard" helper="Helper Text" helperpersistent></mwc-textfield>
</main>
<script>
addEventListener('load', () => document.body.classList.remove('unresolved'));
</script>
</body>
</html>