All Downloads are FREE. Search and download functionalities are using the official Maven repository.

selectpackage.web-types.json Maven / Gradle / Ivy

The newest version!
{
  "$schema": "https://json.schemastore.org/web-types",
  "name": "@vaadin/select",
  "version": "24.5.3",
  "description-markup": "markdown",
  "contributions": {
    "html": {
      "elements": [
        {
          "name": "vaadin-select",
          "description": "`` is a Web Component for selecting values from a list of items.\n\n### Items\n\nUse the `items` property to define possible options for the select:\n\n```html\n\n```\n```js\nconst select = document.querySelector('#select');\nselect.items = [\n  { label: 'Most recent first', value: 'recent' },\n  { component: 'hr' },\n  { label: 'Rating: low to high', value: 'rating-asc', className: 'asc' },\n  { label: 'Rating: high to low', value: 'rating-desc', className: 'desc' },\n  { component: 'hr' },\n  { label: 'Price: low to high', value: 'price-asc', disabled: true },\n  { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\n### Rendering\n\nAlternatively, the content of the select can be populated by using the renderer callback function.\n\nThe renderer function provides `root`, `select` arguments.\nGenerate DOM content, append it to the `root` element and control the state\nof the host element by accessing `select`.\n\n```js\nconst select = document.querySelector('#select');\nselect.renderer = function(root, select) {\n  const listBox = document.createElement('vaadin-list-box');\n  // append 3  elements\n  ['Jose', 'Manolo', 'Pedro'].forEach(function(name) {\n    const item = document.createElement('vaadin-item');\n    item.textContent = name;\n    item.setAttribute('label', name)\n    listBox.appendChild(item);\n  });\n\n  // update the content\n  root.appendChild(listBox);\n};\n```\n\nRenderer is called on initialization of new select and on its opening.\nDOM generated during the renderer call can be reused\nin the next renderer call and will be provided with the `root` argument.\nOn first call it will be empty.\n\n* Hint: By setting the `label` property of inner vaadin-items you will\nbe able to change the visual representation of the selected value in the input part.\n\n### Styling\n\nThe following custom properties are available for styling:\n\nCustom property                    | Description                  | Target element          | Default\n-----------------------------------|------------------------------|----------------------------------\n`--vaadin-field-default-width`     | Default width of the field   | :host                   | `12em`\n`--vaadin-select-text-field-width` | Effective width of the field | `vaadin-select-overlay` |\n`--vaadin-select-overlay-width`    | Width of the overlay         | `vaadin-select-overlay` |\n\n`` provides mostly the same set of shadow DOM parts and state attributes as ``.\nSee [``](https://cdn.vaadin.com/vaadin-web-components/24.5.3/#/elements/vaadin-text-field) for the styling documentation.\n\n\nIn addition to `` parts, the following parts are available for theming:\n\nPart name       | Description\n----------------|----------------\n`toggle-button` | The toggle button\n\nIn addition to `` state attributes, the following state attributes are available for theming:\n\nAttribute | Description                 | Part name\n----------|-----------------------------|-----------\n`opened`  | Set when the select is open | :host\n\nThere are two exceptions in terms of styling compared to ``:\n- the `clear-button` shadow DOM part does not exist in ``.\n- the `input-prevented` state attribute is not supported by ``.\n\n### Internal components\n\nIn addition to `` itself, the following internal\ncomponents are themable:\n\n- `` - has the same API as [``](https://cdn.vaadin.com/vaadin-web-components/24.5.3/#/elements/vaadin-overlay).\n- `` - has the same API as [``](https://cdn.vaadin.com/vaadin-web-components/24.5.3/#/elements/vaadin-button).\n- [``](https://cdn.vaadin.com/vaadin-web-components/24.5.3/#/elements/vaadin-input-container) - an internal element wrapping the button.\n\nNote: the `theme` attribute value set on `` is\npropagated to the internal components listed above.\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
          "attributes": [
            {
              "name": "disabled",
              "description": "If true, the user cannot interact with this element.",
              "value": {
                "type": [
                  "boolean",
                  "null",
                  "undefined"
                ]
              }
            },
            {
              "name": "autofocus",
              "description": "Specify that this control should have input focus when the page loads.",
              "value": {
                "type": [
                  "boolean",
                  "null",
                  "undefined"
                ]
              }
            },
            {
              "name": "label",
              "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
              "value": {
                "type": [
                  "string",
                  "null",
                  "undefined"
                ]
              }
            },
            {
              "name": "invalid",
              "description": "Set to true when the field is invalid.",
              "value": {
                "type": [
                  "boolean",
                  "null",
                  "undefined"
                ]
              }
            },
            {
              "name": "required",
              "description": "Specifies that the user must fill in a value.",
              "value": {
                "type": [
                  "boolean",
                  "null",
                  "undefined"
                ]
              }
            },
            {
              "name": "error-message",
              "description": "Error to show when the field is invalid.",
              "value": {
                "type": [
                  "string",
                  "null",
                  "undefined"
                ]
              }
            },
            {
              "name": "helper-text",
              "description": "String used for the helper text.",
              "value": {
                "type": [
                  "string",
                  "null",
                  "undefined"
                ]
              }
            },
            {
              "name": "accessible-name",
              "description": "String used to label the component to screen reader users.",
              "value": {
                "type": [
                  "string",
                  "null",
                  "undefined"
                ]
              }
            },
            {
              "name": "accessible-name-ref",
              "description": "Id of the element used as label of the component to screen reader users.",
              "value": {
                "type": [
                  "string",
                  "null",
                  "undefined"
                ]
              }
            },
            {
              "name": "overlay-class",
              "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
              "value": {
                "type": [
                  "string",
                  "null",
                  "undefined"
                ]
              }
            },
            {
              "name": "opened",
              "description": "Set when the select is open",
              "value": {
                "type": [
                  "boolean"
                ]
              }
            },
            {
              "name": "value",
              "description": "The `value` property of the selected item, or an empty string\nif no item is selected.\nOn change or initialization, the component finds the item which matches the\nvalue and displays it.\nIf no value is provided to the component, it selects the first item without\nvalue or empty value.\nHint: If you do not want to select any item by default, you can either set all\nthe values of inner vaadin-items, or set the vaadin-select value to\nan inexistent value in the items list.",
              "value": {
                "type": [
                  "string"
                ]
              }
            },
            {
              "name": "name",
              "description": "The name of this element.",
              "value": {
                "type": [
                  "string",
                  "null",
                  "undefined"
                ]
              }
            },
            {
              "name": "placeholder",
              "description": "A hint to the user of what can be entered in the control.\nThe placeholder will be displayed in the case that there\nis no item selected, or the selected item has an empty\nstring label, or the selected item has no label and it's\nDOM content is empty.",
              "value": {
                "type": [
                  "string",
                  "null",
                  "undefined"
                ]
              }
            },
            {
              "name": "readonly",
              "description": "When present, it specifies that the element is read-only.",
              "value": {
                "type": [
                  "boolean"
                ]
              }
            },
            {
              "name": "no-vertical-overlap",
              "description": "Defines whether the overlay should overlap the target element\nin the y-axis, or be positioned right above/below it.",
              "value": {
                "type": [
                  "boolean",
                  "null",
                  "undefined"
                ]
              }
            },
            {
              "name": "theme",
              "description": "The theme variants to apply to the component.",
              "value": {
                "type": [
                  "string",
                  "null",
                  "undefined"
                ]
              }
            }
          ],
          "js": {
            "properties": [
              {
                "name": "disabled",
                "description": "If true, the user cannot interact with this element.",
                "value": {
                  "type": [
                    "boolean",
                    "null",
                    "undefined"
                  ]
                }
              },
              {
                "name": "autofocus",
                "description": "Specify that this control should have input focus when the page loads.",
                "value": {
                  "type": [
                    "boolean",
                    "null",
                    "undefined"
                  ]
                }
              },
              {
                "name": "label",
                "description": "The label text for the input node.\nWhen no light dom defined via [slot=label], this value will be used.",
                "value": {
                  "type": [
                    "string",
                    "null",
                    "undefined"
                  ]
                }
              },
              {
                "name": "invalid",
                "description": "Set to true when the field is invalid.",
                "value": {
                  "type": [
                    "boolean",
                    "null",
                    "undefined"
                  ]
                }
              },
              {
                "name": "required",
                "description": "Specifies that the user must fill in a value.",
                "value": {
                  "type": [
                    "boolean",
                    "null",
                    "undefined"
                  ]
                }
              },
              {
                "name": "errorMessage",
                "description": "Error to show when the field is invalid.",
                "value": {
                  "type": [
                    "string",
                    "null",
                    "undefined"
                  ]
                }
              },
              {
                "name": "helperText",
                "description": "String used for the helper text.",
                "value": {
                  "type": [
                    "string",
                    "null",
                    "undefined"
                  ]
                }
              },
              {
                "name": "accessibleName",
                "description": "String used to label the component to screen reader users.",
                "value": {
                  "type": [
                    "string",
                    "null",
                    "undefined"
                  ]
                }
              },
              {
                "name": "accessibleNameRef",
                "description": "Id of the element used as label of the component to screen reader users.",
                "value": {
                  "type": [
                    "string",
                    "null",
                    "undefined"
                  ]
                }
              },
              {
                "name": "overlayClass",
                "description": "A space-delimited list of CSS class names to set on the overlay element.\nThis property does not affect other CSS class names set manually via JS.\n\nNote, if the CSS class name was set with this property, clearing it will\nremove it from the overlay, even if the same class name was also added\nmanually, e.g. by using `classList.add()` in the `renderer` function.",
                "value": {
                  "type": [
                    "string",
                    "null",
                    "undefined"
                  ]
                }
              },
              {
                "name": "items",
                "description": "An array containing items that will be rendered as the options of the select.\n\n#### Example\n```js\nselect.items = [\n  { label: 'Most recent first', value: 'recent' },\n  { component: 'hr' },\n  { label: 'Rating: low to high', value: 'rating-asc', className: 'asc' },\n  { label: 'Rating: high to low', value: 'rating-desc', className: 'desc' },\n  { component: 'hr' },\n  { label: 'Price: low to high', value: 'price-asc', disabled: true },\n  { label: 'Price: high to low', value: 'price-desc', disabled: true }\n];\n```\n\nNote: each item is rendered by default as the internal `` that is an extension of ``.\nTo render the item with a custom component, provide a tag name by the `component` property.",
                "value": {
                  "type": [
                    "Array."
                  ]
                }
              },
              {
                "name": "opened",
                "description": "Set when the select is open",
                "value": {
                  "type": [
                    "boolean"
                  ]
                }
              },
              {
                "name": "renderer",
                "description": "Custom function for rendering the content of the ``.\nReceives two arguments:\n\n- `root` The `` internal container\n  DOM element. Append your content to it.\n- `select` The reference to the `` element.",
                "value": {
                  "type": [
                    "SelectRenderer",
                    "undefined"
                  ]
                }
              },
              {
                "name": "value",
                "description": "The `value` property of the selected item, or an empty string\nif no item is selected.\nOn change or initialization, the component finds the item which matches the\nvalue and displays it.\nIf no value is provided to the component, it selects the first item without\nvalue or empty value.\nHint: If you do not want to select any item by default, you can either set all\nthe values of inner vaadin-items, or set the vaadin-select value to\nan inexistent value in the items list.",
                "value": {
                  "type": [
                    "string"
                  ]
                }
              },
              {
                "name": "name",
                "description": "The name of this element.",
                "value": {
                  "type": [
                    "string",
                    "null",
                    "undefined"
                  ]
                }
              },
              {
                "name": "placeholder",
                "description": "A hint to the user of what can be entered in the control.\nThe placeholder will be displayed in the case that there\nis no item selected, or the selected item has an empty\nstring label, or the selected item has no label and it's\nDOM content is empty.",
                "value": {
                  "type": [
                    "string",
                    "null",
                    "undefined"
                  ]
                }
              },
              {
                "name": "readonly",
                "description": "When present, it specifies that the element is read-only.",
                "value": {
                  "type": [
                    "boolean"
                  ]
                }
              },
              {
                "name": "noVerticalOverlap",
                "description": "Defines whether the overlay should overlap the target element\nin the y-axis, or be positioned right above/below it.",
                "value": {
                  "type": [
                    "boolean",
                    "null",
                    "undefined"
                  ]
                }
              }
            ],
            "events": [
              {
                "name": "validated",
                "description": "Fired whenever the field is validated."
              },
              {
                "name": "change",
                "description": "Fired when the user commits a value change."
              },
              {
                "name": "invalid-changed",
                "description": "Fired when the `invalid` property changes."
              },
              {
                "name": "opened-changed",
                "description": "Fired when the `opened` property changes."
              },
              {
                "name": "value-changed",
                "description": "Fired when the `value` property changes."
              }
            ]
          }
        }
      ]
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy