ComponentsProNew

Morph Surface

A slim bar with a Feedback button morphs into a text field. Send with Cmd+Enter, then the bar folds back and flashes a success dot.

Customize

accentColor
glowColor
highlightColor

Based on Morph Surface (MIT license) · Terms of use

Props

20 properties
PropertyTypeDefaultDescription
labelstring"Morph Surface"Text next to the dot in the collapsed bar.
triggerLabelstring"Feedback"Text of the button that opens the form.
placeholderstring"What's on your mind?"Hint in the empty field.
submitLabelstring"⌘ Enter"Label of the send shortcut.
animationSpeednumber1Duration multiplier: higher is slower.
collapsedWidthnumber | 'auto'360Width of the collapsed bar.
collapsedHeightnumber44Height of the collapsed bar.
expandedWidthnumber360Width of the open form.
expandedHeightnumber200Height of the open form.
triggerIconReactNode—Icon before the button text.
onSubmit(data: FormData) => void | Promise<void>—Form submit; the text is in the message field.
isOpen / onOpenChangeboolean / (open: boolean) => void—Control the open state from outside.
onOpen / onClose / onSuccess() => void—Called on open, close and successful submit.
springConfig{ type: 'spring'; stiffness: number; damping: number; mass?: number }—Custom spring for the morph.
renderTrigger / renderContent / renderIndicator(props) => ReactNode—Replace the button, form or dot with your own markup.
triggerClassName / contentClassNamestring—Classes for the button and for the form.
accentColorstring"#ffffff"Main colour: the indicator dot, the text caret and the input focus ring.
glowColorstring"rgba(255,255,255,0.08)"Soft glow under the surface.
highlightColorstring"rgba(255,255,255,0.25)"Thin light rim around the surface.
classNamestring—Extra classes.

Dependencies

3 required packages

npm install motion clsx tailwind-merge

Related components

View all