Edit
A component that allows users to edit text in place, switching between a read-only and an editable state.
<script setup lang="ts">
import { Edit } from '@destyler-ui/vue'
</script>
<template>
<Edit.Root placeholder="Placeholder">
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
<Edit.Control>
<Edit.SubmitTrigger>Save</Edit.SubmitTrigger>
<Edit.CancelTrigger>Cancel</Edit.CancelTrigger>
<Edit.EditTrigger>Edit</Edit.EditTrigger>
</Edit.Control>
</Edit.Root>
</template>
import { Edit } from '@destyler-ui/react'
export function Basic() {
return (
<Edit.Root placeholder="Placeholder">
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
<Edit.Control>
<Edit.SubmitTrigger>Save</Edit.SubmitTrigger>
<Edit.CancelTrigger>Cancel</Edit.CancelTrigger>
<Edit.EditTrigger>Edit</Edit.EditTrigger>
</Edit.Control>
</Edit.Root>
)
}
import { Edit } from '@destyler-ui/solid/edit'
export function Basic() {
return (
<Edit.Root placeholder="Placeholder">
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
</Edit.Root>
)
}
<script lang="ts">
import { Edit } from '@destyler-ui/svelte'
</script>
<Edit.Root placeholder="Placeholder">
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
<Edit.Control>
<Edit.SubmitTrigger>Save</Edit.SubmitTrigger>
<Edit.CancelTrigger>Cancel</Edit.CancelTrigger>
<Edit.EditTrigger>Edit</Edit.EditTrigger>
</Edit.Control>
</Edit.Root>
Anatomy
Section titled “Anatomy”<script setup lang="ts">import { Edit } from '@destyler-ui/vue'</script>
<template> <Edit.Root> <Edit.Label /> <Edit.Area> <Edit.Input /> <Edit.Preview /> </Edit.Area> <Edit.Control> <Edit.EditTrigger /> <Edit.SubmitTrigger /> <Edit.CancelTrigger /> </Edit.Control> </Edit.Root></template>import { Edit } from '@destyler-ui/react'
export default function Basic() { return ( <Edit.Root> <Edit.Label /> <Edit.Area> <Edit.Input /> <Edit.Preview /> </Edit.Area> <Edit.Control> <Edit.EditTrigger /> <Edit.SubmitTrigger /> <Edit.CancelTrigger /> </Edit.Control> </Edit.Root> )}import { Edit } from '@destyler-ui/solid'
export default function Basic() { return ( <Edit.Root> <Edit.Label /> <Edit.Area> <Edit.Input /> <Edit.Preview /> </Edit.Area> <Edit.Control> <Edit.EditTrigger /> <Edit.SubmitTrigger /> <Edit.CancelTrigger /> </Edit.Control> </Edit.Root> )}<script lang="ts"> import { Edit } from '@destyler-ui/svelte'</script>
<Edit.Root placeholder="Placeholder"> <Edit.Label>Label</Edit.Label> <Edit.Area> <Edit.Input /> <Edit.Preview /> </Edit.Area> <Edit.Control> <Edit.SubmitTrigger>Save</Edit.SubmitTrigger> <Edit.CancelTrigger>Cancel</Edit.CancelTrigger> <Edit.EditTrigger>Edit</Edit.EditTrigger> </Edit.Control></Edit.Root>Examples
Section titled “Examples”<script setup lang="ts">
import { Edit } from '@destyler-ui/vue'
</script>
<template>
<Edit.Root placeholder="Placeholder">
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
<Edit.Control>
<Edit.SubmitTrigger>Save</Edit.SubmitTrigger>
<Edit.CancelTrigger>Cancel</Edit.CancelTrigger>
<Edit.EditTrigger>Edit</Edit.EditTrigger>
</Edit.Control>
</Edit.Root>
</template>
import { Edit } from '@destyler-ui/react'
export function Basic() {
return (
<Edit.Root placeholder="Placeholder">
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
<Edit.Control>
<Edit.SubmitTrigger>Save</Edit.SubmitTrigger>
<Edit.CancelTrigger>Cancel</Edit.CancelTrigger>
<Edit.EditTrigger>Edit</Edit.EditTrigger>
</Edit.Control>
</Edit.Root>
)
}
import { Edit } from '@destyler-ui/solid/edit'
export function Basic() {
return (
<Edit.Root placeholder="Placeholder">
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
</Edit.Root>
)
}
<script lang="ts">
import { Edit } from '@destyler-ui/svelte'
</script>
<Edit.Root placeholder="Placeholder">
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
<Edit.Control>
<Edit.SubmitTrigger>Save</Edit.SubmitTrigger>
<Edit.CancelTrigger>Cancel</Edit.CancelTrigger>
<Edit.EditTrigger>Edit</Edit.EditTrigger>
</Edit.Control>
</Edit.Root>
Controlled
Section titled “Controlled”Control the edit state and value programmatically.
<script setup lang="ts">
import { Edit } from '@destyler-ui/vue'
</script>
<template>
<Edit.Root placeholder="Placeholder">
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
<Edit.Context v-slot="{ editing }">
<Edit.Control v-if="editing">
<Edit.SubmitTrigger>Save</Edit.SubmitTrigger>
<Edit.CancelTrigger>Cancel</Edit.CancelTrigger>
</Edit.Control>
<Edit.Control v-else>
<Edit.EditTrigger>Edit</Edit.EditTrigger>
</Edit.Control>
</Edit.Context>
</Edit.Root>
</template>
import { useState } from 'react'
import { Edit } from '@destyler-ui/react'
interface ControlledProps {
activationMode?: 'focus' | 'click' | 'dblclick'
placeholder?: string
}
export function Controlled({ activationMode = 'click', placeholder = 'Placeholder' }: ControlledProps) {
const [value, setValue] = useState('')
return (
<Edit.Root
placeholder={placeholder}
activationMode={activationMode}
value={value}
onValueChange={e => setValue(e.value)}
>
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
<Edit.Context>
{context => (
<>
{context.editing
? (
<Edit.Control>
<Edit.SubmitTrigger>Save</Edit.SubmitTrigger>
<Edit.CancelTrigger>Cancel</Edit.CancelTrigger>
</Edit.Control>
)
: (
<Edit.Control>
<Edit.EditTrigger>Edit</Edit.EditTrigger>
</Edit.Control>
)}
</>
)}
</Edit.Context>
</Edit.Root>
)
}
import { Edit } from '@destyler-ui/solid/edit'
import { createSignal, mergeProps, Show } from 'solid-js'
interface ControlledProps {
activationMode?: 'focus' | 'click' | 'dblclick'
placeholder?: string
}
export function Controlled(props: ControlledProps) {
const mergedProps = mergeProps(
{
activationMode: 'click' as const,
placeholder: 'Placeholder',
},
props,
)
const [value, setValue] = createSignal('')
return (
<Edit.Root
placeholder={mergedProps.placeholder}
activationMode={mergedProps.activationMode}
value={value()}
onValueChange={details => setValue(details.value)}
>
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input aria-label="editable input" />
<Edit.Preview />
</Edit.Area>
<Edit.Context>
{edit => (
<Edit.Control>
<Show
when={edit().editing}
fallback={<Edit.EditTrigger>Edit</Edit.EditTrigger>}
>
<Edit.SubmitTrigger>Save</Edit.SubmitTrigger>
<Edit.CancelTrigger>Cancel</Edit.CancelTrigger>
</Show>
</Edit.Control>
)}
</Edit.Context>
</Edit.Root>
)
}
<script module lang="ts">
export interface ControlledProps {
activationMode?: 'focus' | 'click' | 'dblclick'
placeholder?: string
}
</script>
<script lang="ts">
import { Edit } from '@destyler-ui/svelte'
let { activationMode = 'click', placeholder = 'Placeholder' }: ControlledProps = $props()
let value = $state('')
</script>
<Edit.Root {activationMode} {placeholder} bind:value>
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input aria-label="editable input" />
<Edit.Preview />
</Edit.Area>
<Edit.Context>
{#snippet render(edit)}
{#if edit().editing}
<Edit.Control>
<Edit.SubmitTrigger>Save</Edit.SubmitTrigger>
<Edit.CancelTrigger aria-label="cancel">Cancel</Edit.CancelTrigger>
</Edit.Control>
{:else}
<Edit.Control>
<Edit.EditTrigger>Edit</Edit.EditTrigger>
</Edit.Control>
{/if}
{/snippet}
</Edit.Context>
</Edit.Root>
Custom Controls
Section titled “Custom Controls”Customize the edit, submit, and cancel controls.
<script setup lang="ts">
import { Edit } from '@destyler-ui/vue'
import { ref } from 'vue'
const value = ref('Chakra')
</script>
<template>
<Edit.Root placeholder="enter a value" v-model="value">
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
<Edit.Context v-slot="{ editing }">
<Edit.Control v-if="editing">
<Edit.SubmitTrigger>Save</Edit.SubmitTrigger>
<Edit.CancelTrigger>Cancel</Edit.CancelTrigger>
</Edit.Control>
<Edit.Control v-else>
<Edit.EditTrigger>Edit</Edit.EditTrigger>
</Edit.Control>
</Edit.Context>
</Edit.Root>
</template>
import { Edit } from '@destyler-ui/react'
export function CustomControls() {
return (
<Edit.Root placeholder="Placeholder">
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
<Edit.Context>
{context => (
<>
{context.editing
? (
<Edit.Control>
<Edit.SubmitTrigger>Save</Edit.SubmitTrigger>
<Edit.CancelTrigger>Cancel</Edit.CancelTrigger>
</Edit.Control>
)
: (
<Edit.Control>
<Edit.EditTrigger>Edit</Edit.EditTrigger>
</Edit.Control>
)}
</>
)}
</Edit.Context>
</Edit.Root>
)
}
import { Edit } from '@destyler-ui/solid/edit'
import { Show } from 'solid-js'
export function CustomControls() {
return (
<Edit.Root placeholder="enter a value" value="Chakra">
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
<Edit.Context>
{edit => (
<Edit.Control>
<Show
when={edit().editing}
fallback={<Edit.EditTrigger>Edit</Edit.EditTrigger>}
>
<Edit.SubmitTrigger>Save</Edit.SubmitTrigger>
<Edit.CancelTrigger>Canvel</Edit.CancelTrigger>
</Show>
</Edit.Control>
)}
</Edit.Context>
</Edit.Root>
)
}
<script lang="ts">
import { Edit } from '@destyler-ui/svelte'
</script>
<Edit.Root placeholder="Placeholder">
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
<Edit.Context>
{#snippet render(edit)}
{#if edit().editing}
<Edit.Control>
<Edit.SubmitTrigger>Save</Edit.SubmitTrigger>
<Edit.CancelTrigger>Cancel</Edit.CancelTrigger>
</Edit.Control>
{:else}
<Edit.Control>
<Edit.EditTrigger>Edit</Edit.EditTrigger>
</Edit.Control>
{/if}
{/snippet}
</Edit.Context>
</Edit.Root>
With Field
Section titled “With Field”Combine with a form field for validation and labeling.
<script setup lang="ts">
import { Edit } from '@destyler-ui/vue'
import { Field } from '@destyler-ui/vue'
</script>
<template>
<Field.Root>
<Edit.Root placeholder="Placeholder" activationMode="dblclick">
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
</Edit.Root>
<Field.HelperText>Additional Info</Field.HelperText>
<Field.ErrorText>Error Info</Field.ErrorText>
</Field.Root>
</template>
import { Field } from '@destyler-ui/react'
import { Edit } from '@destyler-ui/react'
interface WithFieldProps {
required?: boolean
disabled?: boolean
readOnly?: boolean
invalid?: boolean
}
export function WithField({ required, disabled, readOnly, invalid }: WithFieldProps) {
return (
<Field.Root invalid={invalid}>
<Edit.Root
placeholder="Placeholder"
activationMode="dblclick"
required={required}
disabled={disabled}
readOnly={readOnly}
invalid={invalid}
>
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
</Edit.Root>
<Field.HelperText>Additional Info</Field.HelperText>
<Field.ErrorText>Error Info</Field.ErrorText>
</Field.Root>
)
}
import { Edit } from '@destyler-ui/solid/edit'
import { Field } from '@destyler-ui/solid/field'
export function WithField(props: Field.RootProps) {
return (
<Field.Root {...props} readOnly>
<Edit.Root placeholder="Placeholder" activationMode="dblclick">
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
</Edit.Root>
<Field.HelperText>Additional Info</Field.HelperText>
<Field.ErrorText>Error Info</Field.ErrorText>
</Field.Root>
)
}
<script module lang="ts">
export interface WithFieldProps {
required?: boolean
disabled?: boolean
readOnly?: boolean
invalid?: boolean
}
</script>
<script lang="ts">
import { Field } from '@destyler-ui/svelte'
import { Edit } from '@destyler-ui/svelte'
const props: WithFieldProps = $props()
</script>
<Field.Root invalid={props.invalid}>
<Edit.Root placeholder="Placeholder" activationMode="dblclick" {...props}>
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input aria-label="editable input" />
<Edit.Preview />
</Edit.Area>
</Edit.Root>
<Field.HelperText>Additional Info</Field.HelperText>
<Field.ErrorText>Error Info</Field.ErrorText>
</Field.Root>
Root Provider
Section titled “Root Provider”<script setup lang="ts">
import { Edit, useEdit } from '@destyler-ui/vue'
const editable = useEdit({ placeholder: 'Placeholder' })
</script>
<template>
<button @click="editable.edit()">Edit</button>
<Edit.RootProvider :value="editable">
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
</Edit.RootProvider>
</template>
import { Edit, useEdit } from '@destyler-ui/react'
export function RootProvider() {
const editable = useEdit({ placeholder: 'Placeholder' })
return (
<>
<button type="button" onClick={() => editable.edit()}>Edit</button>
<Edit.RootProvider value={editable}>
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
</Edit.RootProvider>
</>
)
}
import { Edit, useEdit } from '@destyler-ui/solid/edit'
export function RootProvider() {
const edit = useEdit({ placeholder: 'Placeholder' })
return (
<>
<button onClick={() => edit().edit()}>Edit</button>
<Edit.RootProvider value={edit}>
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
</Edit.RootProvider>
</>
)
}
<script lang="ts">
import { Edit, useEdit } from '@destyler-ui/svelte'
const id = $props.id()
const editable = useEdit({ id, placeholder: 'Placeholder' })
</script>
<button type="button" onclick={() => editable().edit()}>Edit from API</button>
<Edit.RootProvider value={editable}>
<Edit.Label>Label</Edit.Label>
<Edit.Area>
<Edit.Input />
<Edit.Preview />
</Edit.Area>
</Edit.RootProvider>
API Reference
Section titled “API Reference”Root
| Prop | Default | Type |
|---|---|---|
activationMode | "focus" | "focus" | "dblclick" | "click"The activation mode for the preview element. - "focus" - Enter edit mode when the preview is focused - "dblclick" - Enter edit mode when the preview is double-clicked - "click" - Enter edit mode when the preview is clicked |
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
autoResize | — | false | trueWhether the edit should auto-resize to fit the content. |
defaultEdit | — | false | trueThe initial edit state of the edit when it is first rendered. Use when you do not need to control its edit state. |
defaultValue | — | stringThe initial value of the edit when it is first rendered. Use when you do not need to control the state of the edit. |
disabled | — | false | trueWhether the edit is disabled |
edit | — | false | trueWhether the edit is in edit mode. |
finalFocusEl | — | () => HTMLElement | nullThe element that should receive focus when the edit is closed. By default, it will focus on the trigger element. |
form | — | stringThe associate form of the underlying input. |
id | — | stringThe unique identifier of the machine. |
ids | — | Partial<{ root: string; area: string; label: string; preview: string; input: string; control: string; submitTrigger: string; cancelTrigger: string; editTrigger: string; }>The ids of the elements in the edit. Useful for composition. |
invalid | — | false | trueWhether the input's value is invalid. |
maxLength | — | numberThe maximum number of characters allowed in the edit |
modelValue | — | string |
name | — | stringThe name attribute of the edit component. Used for form submission. |
placeholder | — | string | { edit: string; preview: string; }The placeholder value to show when the `value` is empty |
readOnly | — | false | trueWhether the edit is readonly |
required | — | false | trueWhether the edit is required |
selectOnFocus | true | false | trueWhether to select the text in the input when it is focused. |
submitMode | "both" | "none" | "enter" | "blur" | "both"The action that triggers submit in the edit mode: - "enter" - Trigger submit when the enter key is pressed - "blur" - Trigger submit when the edit is blurred - "none" - No action will trigger submit. You need to use the submit button - "both" - Pressing `Enter` and blurring the input will trigger submit |
translations | — | edit.IntlTranslationsSpecifies the localized strings that identifies the accessibility elements and their states |
| Emit | Event |
|---|---|
editChange | [details: EditChangeDetails]The callback that is called when the edit mode is changed |
focusOutside | [event: FocusOutsideEvent]Function called when the focus is moved outside the component |
interactOutside | [event: InteractOutsideEvent]Function called when an interaction happens outside the component |
pointerDownOutside | [event: PointerDownOutsideEvent]Function called when the pointer is pressed down outside the component |
update:edit | [edit: boolean]Event handler called when the edit state of the combobox changes. |
update:modelValue | [value: string]The callback fired when the model value changes. |
valueChange | [details: ValueChangeDetails]The callback that is called when the edit's value is changed |
valueCommit | [details: ValueChangeDetails]The callback that is called when the edit's value is submitted. |
valueRevert | [details: ValueChangeDetails]The callback that is called when the esc key is pressed or the cancel button is clicked |
Area
| Prop | Default | Type |
|---|---|---|
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
CancelTrigger
| Prop | Default | Type |
|---|---|---|
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
Context
No serializable props or emits are declared for this part.
Control
| Prop | Default | Type |
|---|---|---|
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
EditTrigger
| Prop | Default | Type |
|---|---|---|
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
Input
| Prop | Default | Type |
|---|---|---|
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
Label
| Prop | Default | Type |
|---|---|---|
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
Preview
| Prop | Default | Type |
|---|---|---|
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
RootProvider
| Prop | Default | Type |
|---|---|---|
value* | — | MachineApi<PropTypes> |
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
SubmitTrigger
| Prop | Default | Type |
|---|---|---|
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
Root
| Prop | Default | Type |
|---|---|---|
activationMode | "focus" | "focus" | "dblclick" | "click"The activation mode for the preview element. - "focus" - Enter edit mode when the preview is focused - "dblclick" - Enter edit mode when the preview is double-clicked - "click" - Enter edit mode when the preview is clicked |
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
autoResize | — | false | trueWhether the editable should auto-resize to fit the content. |
defaultEdit | — | false | trueThe initial edit state of the editable when it is first rendered. Use when you do not need to control its edit state. |
defaultValue | — | stringThe initial value of the editable when it is first rendered. Use when you do not need to control the state of the editable. |
disabled | — | false | trueWhether the editable is disabled |
edit | — | false | trueWhether the editable is in edit mode. |
finalFocusEl | — | () => HTMLElement | nullThe element that should receive focus when the editable is closed. By default, it will focus on the trigger element. |
form | — | stringThe associate form of the underlying input. |
id | — | stringThe unique identifier of the machine. |
ids | — | Partial<{ root: string; area: string; label: string; preview: string; input: string; control: string; submitTrigger: string; cancelTrigger: string; editTrigger: string; }>The ids of the elements in the editable. Useful for composition. |
invalid | — | false | trueWhether the input's value is invalid. |
maxLength | — | numberThe maximum number of characters allowed in the editable |
name | — | stringThe name attribute of the editable component. Used for form submission. |
onEditChange | — | (details: edit.EditChangeDetails) => voidThe callback that is called when the edit mode is changed |
onFocusOutside | — | (event: calendar.FocusOutsideEvent) => voidFunction called when the focus is moved outside the component |
onInteractOutside | — | (event: calendar.InteractOutsideEvent) => voidFunction called when an interaction happens outside the component |
onPointerDownOutside | — | (event: calendar.PointerDownOutsideEvent) => voidFunction called when the pointer is pressed down outside the component |
onValueChange | — | (details: edit.ValueChangeDetails) => voidThe callback that is called when the editable's value is changed |
onValueCommit | — | (details: edit.ValueChangeDetails) => voidThe callback that is called when the editable's value is submitted. |
onValueRevert | — | (details: edit.ValueChangeDetails) => voidThe callback that is called when the esc key is pressed or the cancel button is clicked |
placeholder | — | string | { edit: string; preview: string; }The placeholder value to show when the `value` is empty |
readOnly | — | false | trueWhether the editable is readonly |
required | — | false | trueWhether the editable is required |
selectOnFocus | true | false | trueWhether to select the text in the input when it is focused. |
submitMode | "both" | "none" | "enter" | "blur" | "both"The action that triggers submit in the edit mode: - "enter" - Trigger submit when the enter key is pressed - "blur" - Trigger submit when the editable is blurred - "none" - No action will trigger submit. You need to use the submit button - "both" - Pressing `Enter` and blurring the input will trigger submit |
translations | — | edit.IntlTranslationsSpecifies the localized strings that identifies the accessibility elements and their states |
value | — | stringThe value of the editable in both edit and preview mode |
Area
| Prop | Default | Type |
|---|---|---|
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
CancelTrigger
| Prop | Default | Type |
|---|---|---|
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
Context
| Prop | Default | Type |
|---|---|---|
children* | — | (context: UseEditContext) => ReactNode |
Control
| Prop | Default | Type |
|---|---|---|
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
EditTrigger
| Prop | Default | Type |
|---|---|---|
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
Input
| Prop | Default | Type |
|---|---|---|
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
Label
| Prop | Default | Type |
|---|---|---|
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
Preview
| Prop | Default | Type |
|---|---|---|
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
RootProvider
| Prop | Default | Type |
|---|---|---|
value* | — | UseEditReturn |
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
SubmitTrigger
| Prop | Default | Type |
|---|---|---|
asChild | — | false | trueUse the provided child element as the default rendered element, combining their props and behavior. |
Root
| Prop | Default | Type |
|---|---|---|
activationMode | "focus" | "focus" | "dblclick" | "click"The activation mode for the preview element. - "focus" - Enter edit mode when the preview is focused - "dblclick" - Enter edit mode when the preview is double-clicked - "click" - Enter edit mode when the preview is clicked |
asChild | — | (props: (userProps?: solid_js393.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.ElementUse the provided child element as the default rendered element, combining their props and behavior. |
autoResize | — | false | trueWhether the editable should auto-resize to fit the content. |
defaultEdit | — | false | trueThe initial edit state of the edit when it is first rendered. Use when you do not need to control its edit state. |
defaultValue | — | stringThe initial value of the edit when it is first rendered. Use when you do not need to control the state of the edit. |
disabled | — | false | trueWhether the editable is disabled |
edit | — | false | trueWhether the editable is in edit mode. |
finalFocusEl | — | () => HTMLElement | nullThe element that should receive focus when the editable is closed. By default, it will focus on the trigger element. |
form | — | stringThe associate form of the underlying input. |
ids | — | Partial<{ root: string; area: string; label: string; preview: string; input: string; control: string; submitTrigger: string; cancelTrigger: string; editTrigger: string; }>The ids of the elements in the editable. Useful for composition. |
invalid | — | false | trueWhether the input's value is invalid. |
maxLength | — | numberThe maximum number of characters allowed in the editable |
name | — | stringThe name attribute of the editable component. Used for form submission. |
onEditChange | — | (details: edit.EditChangeDetails) => voidThe callback that is called when the edit mode is changed |
onFocusOutside | — | (event: edit.FocusOutsideEvent) => voidFunction called when the focus is moved outside the component |
onInteractOutside | — | (event: edit.InteractOutsideEvent) => voidFunction called when an interaction happens outside the component |
onPointerDownOutside | — | (event: edit.PointerDownOutsideEvent) => voidFunction called when the pointer is pressed down outside the component |
onValueChange | — | (details: ValueChangeDetails) => voidThe callback that is called when the editable's value is changed |
onValueCommit | — | (details: ValueChangeDetails) => voidThe callback that is called when the editable's value is submitted. |
onValueRevert | — | (details: ValueChangeDetails) => voidThe callback that is called when the esc key is pressed or the cancel button is clicked |
placeholder | — | string | { edit: string; preview: string; }The placeholder value to show when the `value` is empty |
readOnly | — | false | trueWhether the editable is readonly |
required | — | false | trueWhether the editable is required |
selectOnFocus | true | false | trueWhether to select the text in the input when it is focused. |
submitMode | "both" | "none" | "enter" | "blur" | "both"The action that triggers submit in the edit mode: - "enter" - Trigger submit when the enter key is pressed - "blur" - Trigger submit when the editable is blurred - "none" - No action will trigger submit. You need to use the submit button - "both" - Pressing `Enter` and blurring the input will trigger submit |
translations | — | edit.IntlTranslationsSpecifies the localized strings that identifies the accessibility elements and their states |
value | — | stringThe value of the editable in both edit and preview mode |
Area
| Prop | Default | Type |
|---|---|---|
asChild | — | (props: (userProps?: solid_js393.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.ElementUse the provided child element as the default rendered element, combining their props and behavior. |
CancelTrigger
| Prop | Default | Type |
|---|---|---|
asChild | — | (props: (userProps?: solid_js393.JSX.ButtonHTMLAttributes<HTMLButtonElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.ElementUse the provided child element as the default rendered element, combining their props and behavior. |
Context
| Prop | Default | Type |
|---|---|---|
children* | — | (context: UseEditContext) => Element |
Control
| Prop | Default | Type |
|---|---|---|
asChild | — | (props: (userProps?: solid_js393.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.ElementUse the provided child element as the default rendered element, combining their props and behavior. |
EditTrigger
| Prop | Default | Type |
|---|---|---|
asChild | — | (props: (userProps?: solid_js393.JSX.ButtonHTMLAttributes<HTMLButtonElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.ElementUse the provided child element as the default rendered element, combining their props and behavior. |
Input
| Prop | Default | Type |
|---|---|---|
asChild | — | (props: (userProps?: solid_js393.JSX.InputHTMLAttributes<HTMLInputElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.ElementUse the provided child element as the default rendered element, combining their props and behavior. |
Label
| Prop | Default | Type |
|---|---|---|
asChild | — | (props: (userProps?: solid_js393.JSX.LabelHTMLAttributes<HTMLLabelElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.ElementUse the provided child element as the default rendered element, combining their props and behavior. |
Preview
| Prop | Default | Type |
|---|---|---|
asChild | — | (props: (userProps?: solid_js393.JSX.HTMLAttributes<HTMLSpanElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.ElementUse the provided child element as the default rendered element, combining their props and behavior. |
RootProvider
| Prop | Default | Type |
|---|---|---|
value* | — | UseEditReturn |
asChild | — | (props: (userProps?: solid_js393.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.ElementUse the provided child element as the default rendered element, combining their props and behavior. |
SubmitTrigger
| Prop | Default | Type |
|---|---|---|
asChild | — | (props: (userProps?: solid_js393.JSX.ButtonHTMLAttributes<HTMLButtonElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.ElementUse the provided child element as the default rendered element, combining their props and behavior. |
Root
| Prop | Default | Type |
|---|---|---|
activationMode | "focus" | "focus" | "dblclick" | "click"The activation mode for the preview element. - "focus" - Enter edit mode when the preview is focused - "dblclick" - Enter edit mode when the preview is double-clicked - "click" - Enter edit mode when the preview is clicked |
autoResize | — | false | trueWhether the editable should auto-resize to fit the content. |
defaultEdit | — | false | true |
defaultValue | — | string |
disabled | — | false | trueWhether the editable is disabled |
edit | — | false | trueWhether the editable is in edit mode. |
finalFocusEl | — | () => HTMLElement | nullThe element that should receive focus when the editable is closed. By default, it will focus on the trigger element. |
form | — | stringThe associate form of the underlying input. |
id | — | string |
ids | — | Partial<{ root: string; area: string; label: string; preview: string; input: string; control: string; submitTrigger: string; cancelTrigger: string; editTrigger: string; }>The ids of the elements in the editable. Useful for composition. |
invalid | — | false | trueWhether the input's value is invalid. |
maxLength | — | numberThe maximum number of characters allowed in the editable |
name | — | stringThe name attribute of the editable component. Used for form submission. |
onEditChange | — | ((details: EditChangeDetails) => void) | undefinedThe callback that is called when the edit mode is changed |
onFocusOutside | — | ((event: FocusOutsideEvent) => void) | undefinedFunction called when the focus is moved outside the component |
onInteractOutside | — | ((event: InteractOutsideEvent) => void) | undefinedFunction called when an interaction happens outside the component |
onPointerDownOutside | — | ((event: PointerDownOutsideEvent) => void) | undefinedFunction called when the pointer is pressed down outside the component |
onValueChange | — | (details: import("/home/runner/work/ui/ui/packages/svelte/dist/index").EditValueChangeDetails) => voidThe callback that is called when the editable's value is changed |
onValueCommit | — | (details: import("/home/runner/work/ui/ui/packages/svelte/dist/index").EditValueChangeDetails) => voidThe callback that is called when the editable's value is submitted. |
onValueRevert | — | (details: import("/home/runner/work/ui/ui/packages/svelte/dist/index").EditValueChangeDetails) => voidThe callback that is called when the esc key is pressed or the cancel button is clicked |
placeholder | — | string | { edit: string; preview: string; }The placeholder value to show when the `value` is empty |
readOnly | — | false | trueWhether the editable is readonly |
required | — | false | trueWhether the editable is required |
selectOnFocus | true | false | trueWhether to select the text in the input when it is focused. |
submitMode | "both" | "none" | "enter" | "blur" | "both"The action that triggers submit in the edit mode: - "enter" - Trigger submit when the enter key is pressed - "blur" - Trigger submit when the editable is blurred - "none" - No action will trigger submit. You need to use the submit button - "both" - Pressing `Enter` and blurring the input will trigger submit |
translations | — | IntlTranslations | undefinedSpecifies the localized strings that identifies the accessibility elements and their states |
value | — | stringThe value of the editable in both edit and preview mode |
Area
| Prop | Default | Type |
|---|---|---|
asChild | — | import("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]> |
children | — | Snippet<[]> | undefined |
CancelTrigger
| Prop | Default | Type |
|---|---|---|
asChild | — | import("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"button">]> |
children | — | Snippet<[]> | undefined |
Context
| Prop | Default | Type |
|---|---|---|
render* | — | Snippet<[UseEditContext]> |
Control
| Prop | Default | Type |
|---|---|---|
asChild | — | import("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]> |
children | — | Snippet<[]> | undefined |
EditTrigger
| Prop | Default | Type |
|---|---|---|
asChild | — | import("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"button">]> |
children | — | Snippet<[]> | undefined |
Input
| Prop | Default | Type |
|---|---|---|
asChild | — | import("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"input">]> |
children | — | Snippet<[]> | undefined |
Label
| Prop | Default | Type |
|---|---|---|
asChild | — | import("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"label">]> |
children | — | Snippet<[]> | undefined |
Preview
| Prop | Default | Type |
|---|---|---|
asChild | — | import("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"span">]> |
children | — | Snippet<[]> | undefined |
RootProvider
| Prop | Default | Type |
|---|---|---|
value* | — | UseEditReturn |
asChild | — | import("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]> |
children | — | Snippet<[]> | undefined |
SubmitTrigger
| Prop | Default | Type |
|---|---|---|
asChild | — | import("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"button">]> |
children | — | Snippet<[]> | undefined |