Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/uiPublic

Feedback: terrible experience with forms #21

Open
Labels
bugSomething isn't workingenhancementNew feature or requesthelp wantedExtra attention is needed
@x0k

Description

@x0k

I have been trying to use this library to create forms and here are my thoughts:

  • Limited set of attributes for standard elements. Here are a few cases
    • type (submit,reset, etc), forButton
    • class,style,readonly, etc. forInput
    • data-* attributes
  • Weak typing compared to standard elements:
    • string | string[] inChoicebox
    • string inInput withtype="number"
  • Inconvenient behavior of controlled components. You cannot passundefined as the initial value because... no reason.
    ButChoicebox is something special. Even if you provide an initial value fortype=“checkbox” as an array, your value will immediately be replaced with“” because.... no reason.
  • Lack of standard inputs:
    • Thetype attribute ofInput is very limited. (there is nocolor,file,range,datetime-local,time,tel,url)
    • Select withmultiple does not exist
  • Components are too rigid. For example,Input has anerror property, but you can't pass multiple errors to it. Ok, you will render an errors list by yourself, but how to trigger error state of theInput now?

My recommendations:

  • Extend standard element props if you use it internally
// MyButton.svelteimporttype{HTMLButtonAttributes}from"svelte/elements";interfaceMyButtonPropsextendsHTMLButtonAttributes{ ...}
  • Always use strong types
interfaceCommonChoiceboxProps{ ...}typeChoiceboxProps=({type:"checkbox"value:string[]}|{type:"radio"value:string})&CommonChoiceboxProps
  • Prefer small stand-alone components rather than all-in-one components (likeInput), and then compose them into blocks. That way, if your block abstraction leaks, the user can drop down to a lower level and customize low-level components to meet their requirements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp