|
| 1 | +.. index:: |
| 2 | + single: Forms; Fields; ColorType |
| 3 | + |
| 4 | +ColorType Field |
| 5 | +=============== |
| 6 | + |
| 7 | +The ``ColorType`` field is a text field that is rendered using the HTML5 |
| 8 | +``<input type="color">`` tag. Depending on each browser, the behavior of this |
| 9 | +form field can vary substantially. Some browsers display it as a simple text |
| 10 | +field, while others display a native color picker. |
| 11 | + |
| 12 | +The value of the underlying ``<input type="color">`` field is always a |
| 13 | +7-character string specifying an RGB color in lower case hexadecimal notation. |
| 14 | +That's why it's not possible to select semi-transparent colors with this |
| 15 | +element. |
| 16 | + |
| 17 | ++-------------+---------------------------------------------------------------------+ |
| 18 | +| Rendered as | ``input`` ``color`` field (a text box) | |
| 19 | ++-------------+---------------------------------------------------------------------+ |
| 20 | +| Inherited | - `data`_ | |
| 21 | +| options | - `disabled`_ | |
| 22 | +| | - `empty_data`_ | |
| 23 | +| | - `error_bubbling`_ | |
| 24 | +| | - `error_mapping`_ | |
| 25 | +| | - `label`_ | |
| 26 | +| | - `label_attr`_ | |
| 27 | +| | - `label_format`_ | |
| 28 | +| | - `mapped`_ | |
| 29 | +| | - `required`_ | |
| 30 | +| | - `trim`_ | |
| 31 | ++-------------+---------------------------------------------------------------------+ |
| 32 | +| Parent type | :doc:`TextType </reference/forms/types/text>` | |
| 33 | ++-------------+---------------------------------------------------------------------+ |
| 34 | +| Class | :class:`Symfony\\Component\\Form\\Extension\\Core\\Type\\ColorType` | |
| 35 | ++-------------+---------------------------------------------------------------------+ |
| 36 | + |
| 37 | +Inherited Options |
| 38 | +----------------- |
| 39 | + |
| 40 | +These options inherit from the :doc:`FormType </reference/forms/types/form>`: |
| 41 | + |
| 42 | +.. include:: /reference/forms/types/options/data.rst.inc |
| 43 | + |
| 44 | +.. include:: /reference/forms/types/options/disabled.rst.inc |
| 45 | + |
| 46 | +.. include:: /reference/forms/types/options/empty_data.rst.inc |
| 47 | + :end-before: DEFAULT_PLACEHOLDER |
| 48 | + |
| 49 | +The default value is ``''`` (the empty string). |
| 50 | + |
| 51 | +.. include:: /reference/forms/types/options/empty_data.rst.inc |
| 52 | + :start-after: DEFAULT_PLACEHOLDER |
| 53 | + |
| 54 | +.. include:: /reference/forms/types/options/error_bubbling.rst.inc |
| 55 | + |
| 56 | +.. include:: /reference/forms/types/options/error_mapping.rst.inc |
| 57 | + |
| 58 | +.. include:: /reference/forms/types/options/label.rst.inc |
| 59 | + |
| 60 | +.. include:: /reference/forms/types/options/label_attr.rst.inc |
| 61 | + |
| 62 | +.. include:: /reference/forms/types/options/label_format.rst.inc |
| 63 | + |
| 64 | +.. include:: /reference/forms/types/options/mapped.rst.inc |
| 65 | + |
| 66 | +.. include:: /reference/forms/types/options/required.rst.inc |
| 67 | + |
| 68 | +.. include:: /reference/forms/types/options/trim.rst.inc |
0 commit comments