Components/AI

Editable Question

Interactive question component with inline editing, copy functionality, and real-time updates

Live Preview
Open in
How can I implement a responsive navigation menu in React?

Example

export default function EditableQuestionExample() {
  const handleQuestionChange = (newQuestion: string) => {
    console.log('Question updated:', newQuestion)
  }

  return (
    <EditableQuestion
      question="What are the best practices for state management in React?"
      onQuestionChange={handleQuestionChange}
      className="w-full"
    />
  )
}

Documentation

PropTypeDefaultDescription
classNamestringundefinedAdditional CSS classes for styling
questionstring""The question text to display and edit
onQuestionChange(newQuestion: string) => voidundefinedCallback when the question text changes

Types

type EditableQuestionProps = {
  className?: string
  question?: string
  onQuestionChange?: (newQuestion: string) => void
}

Features

  • Inline Editing: Click to edit question text directly in the interface
  • Copy Functionality: One-click copy with visual feedback and success state
  • Keyboard Shortcuts: Ctrl+Enter to save, Escape to cancel
  • Real-time Updates: Immediate callback when question content changes
  • Visual Feedback: Clear editing states and hover effects
  • Responsive Design: Adapts to different screen sizes with proper text wrapping
  • Dark Mode Support: Full dark mode compatibility with appropriate styling
  • Accessibility Focused: Proper ARIA labels and keyboard navigation support