Ghost input
Text that reads as plain text until you point at it, for inline edits such as titles. It has no border or fill at rest. Use <lat-input> instead when the field needs a label and should look like a form. Rules: UX Elements & Rules → GhostInput.
Add it to a page
Load the pinned file once in your Latitude Site or web page, then use the tag.
<script type="module" src="https://web-components.sites.latd.com/components/lat-ghost-input/0.1.0/lat-ghost-input.js"></script>The file is an ES module. It loads Lit, the design-system tokens and the Roobert stylesheet from this catalog once per page, however many components you use.
| Version | 0.1.0 |
|---|---|
| File | /components/lat-ghost-input/0.1.0/lat-ghost-input.js (2.0 KB gzipped) |
| SHA-256 | 42116a134f41d17b857307ccaded9fae1c36e9d6a76fa48d062f35d9da6982b0 |
Permutations
Regular and medium
Dark
Light
<div style="width: 240px">
<lat-ghost-input label="Study title" value="Q3 brand lift"></lat-ghost-input>
</div>
<div style="width: 240px">
<lat-ghost-input label="Study title" size="medium" value="Q3 brand lift"></lat-ghost-input>
</div>Empty
Dark
Light
<div style="width: 240px">
<lat-ghost-input label="Clip title" placeholder="Add a title"></lat-ghost-input>
</div>Aligned right
Dark
Light
<div style="width: 240px">
<lat-ghost-input label="Clip title" align="right" value="Opening scene"></lat-ghost-input>
</div>With reset
Dark
Light
<div style="width: 240px">
<lat-ghost-input label="Clip title" clearable value="Opening scene"></lat-ghost-input>
</div>Readonly and disabled
Dark
Light
<div style="width: 240px">
<lat-ghost-input label="Study title" readonly value="Q3 brand lift"></lat-ghost-input>
</div>
<div style="width: 240px">
<lat-ghost-input label="Study title" disabled value="Q3 brand lift"></lat-ghost-input>
</div>In a form
Dark
Light
<form
style="display: flex; flex-wrap: wrap; align-items: center; gap: 16px"
onsubmit="event.preventDefault();
this.querySelector('output').value = 'Saved'">
<div style="width: 240px">
<lat-ghost-input label="Study title" name="title" required
value="Q3 brand lift"></lat-ghost-input>
</div>
<lat-button variant="primary" size="sm" type="submit">Save</lat-button>
<output></output>
</form>Editing
Enter or leaving the field commits the edit and fires change, if the text changed. Escape puts back the text from before the edit. Enter never submits a surrounding form.
Attributes
| Attribute | Values | Notes |
|---|---|---|
label | text | Required. The field's name for screen readers; nothing is shown. |
value | text | The initial text. The value property holds the current one; resetting the form puts this back. |
placeholder | text | Shown when empty, such as “Add a title”. |
name | text | Submitted with the form. |
size | regular (default, 24px), medium (28px) | |
align | left (default), right | |
clearable | boolean | The spec's Reset: a clear (×) button after the text, shown on hover or keyboard focus. |
required | boolean | An empty edit is put back instead of committed. |
readonly | boolean | No hover fill; the text can be selected but not changed. |
disabled | boolean |
Events
| Event | Notes |
|---|---|
input | On every keystroke. |
change | When an edit is committed with new text, or the text is cleared. |