<tap-pat-editor>

Single-field edit page, modeled on editing a name in iOS Settings. Suited to opening from a settings row to edit a name, bio, etc.

Done is enabled only after the value changes (and, with required, is not blank). Clicking it or pressing Enter only emits change; going back or closing is up to the caller.

Example

With settings

Push it from a tap-pat-settings row and pop back after saving.

import { html } from '@mantou/gem/lib/element';
import { Stack } from '@mantou/tap-ui/elements/stack';

import '@mantou/tap-ui/patterns/editor';

const editName = () => {
  Stack.push({
    gesture: true,
    content: html`
      <tap-pat-editor
        heading="Name"
        back
        required
        value=${name}
        @change=${(evt) => {
          name = evt.detail;
          Stack.pop();
        }}
      ></tap-pat-editor>
    `,
  });
};

API

单字段编辑页,例如设置中的名称、简介

点击完成或回车后只发出 change,关闭或返回由调用方处理

Extends GemElement

Instance Properties

Property(Attribute) Reactive Type Description
heading(heading) Yes string
value(value) Yes string
placeholder(placeholder) Yes string
description(description) Yes string Note below the input, e.g. what the value is used for
type(type) Yes TapInputElement['type']
back(back) Yes boolean Show the back button of the navbar, pops the closest stack
required(required) Yes boolean Disable done while the value is blank
change Emitter<string>

Other

Type Value
Event change