diff --git a/docs/guide.rst b/docs/guide.rst index 51c5779..c24c53f 100644 --- a/docs/guide.rst +++ b/docs/guide.rst @@ -1076,125 +1076,353 @@ Korona supports input tag attributes like: - accept(str): Specifies the types of files that the server accepts. The accept attribute can only be used with . +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'accept': 'audio/*', 'type': 'file'}) + input1.construct() + # + - align (str): Specifies the alignment of an image input. The align attribute is only used with . +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'align': 'left', 'type': 'image'}) + input1.construct() + # + - alt (str): Specifies an alternate text for images. The alt attribute can only be used with . +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'alt': 'temp', 'type': 'image'}) + input1.construct() + # + - autocomplete (str): Specifies whether an element should have autocomplete enabled. The autocomplete attribute works with the following types: text, search, url, tel, email, password, datepickers, range, and color. +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'autocomplete': 'on', 'type': 'email'}) + input1.construct() + # + - autofocus (bool): Specifies that an element should automatically get focus when the page loads. +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'autofocus': True}) + input1.construct() + # + - checked (bool): Specifies that an element should be pre-selected when the page loads. The checked attribute can be used with and . +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'checked': True, 'type': 'radio'}) + input1.construct() + # + - dirname (str): Specifies that the text direction will be submitted. The dirname attribute's value is always the name of the input field, followed by ".dir". +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'name': 'fname', 'dirname': 'fname.dir'}) + input1.construct() + # + - disabled (bool): Specifies that an element should be disabled. +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'disabled': True}) + input1.construct() + # + - form (str): Specifies one or more forms the element belongs to. +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'form': 'form1'}) + input1.construct() + # + - formaction (str): Specifies the URL of the file that will process the input control when the form is submitted. The formaction attribute is used with type="submit" and type="image". +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'formaction': 'demo.asp', 'type': 'submit'}) + input1.construct() + # + - formenctype (str): Specifies how the form-data should be encoded when submitting it to the server. The formenctype attribute is used with type="submit" and type="image". +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'formenctype': 'application/x-www-form-urlencoded', 'type': 'submit'}) + input1.construct() + # + - formmethod (str): Defines the HTTP method for sending data to the action URL. The formmethod attribute can be used with type="submit" and type="image". +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'formmethod': 'get', 'type': 'submit'}) + input1.construct() + # + - formnovalidate (bool): Defines that form elements should not be validated when submitted. The formnovalidate attribute can be used with type="submit". +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'formnovalidate': True, 'type': 'submit'}) + input1.construct() + # + - formtarget (str): Specifies where to display the response that is received after submitting the form. The formtarget attribute can be used with type="submit" and type="image". +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'formtarget': '_parent', 'type': 'submit'}) + input1.construct() + # + - height (int/float): Specifies the height of an element. The height attribute is used only with . +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'height': '200', 'type': 'image'}) + input1.construct() + # + - list (str): Refers to a element that contains pre-defined options for an element. +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'list': 'list1'}) + input1.construct() + # + - max (int/date/time): Specifies the maximum value for an element. The max attribute works with the following input types: number, range, date, datetime, datetime-local, month, time and week. +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'max': date.today(), 'type': 'date'}) + input1.construct() + # + - maxlength (int): Specifies the maximum number of characters allowed in an element. +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'maxlength': '5'}) + input1.construct() + # + - min (int/date/time): Specifies a minimum value for an element. The min attribute works with the following input types: number, range, date, datetime, datetime-local, month, time and week. +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'min': date.today(), 'type': 'date'}) + input1.construct() + # + - multiple (bool): Specifies that a user can enter more than one value in an element. The multiple attribute works with the following input types: email, and file. +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'multiple': True, 'type': 'file'}) + input1.construct() + # + - name (str): Specifies the name of an element. +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'name': 'name1'}) + input1.construct() + # + - pattern (str): Specifies a regular expression that an element's value is checked against. The pattern attribute works with the following input types: text, date, search, url, tel, email, and password. +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'pattern': '[A-Za-z]{3}', 'type': 'email'}) + input1.construct() + # + - placeholder (str): Specifies a short hint that describes the expected value of an element. The placeholder attribute works with the following input types: text, search, url, tel, email, and password. +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'placeholder': 'Full name', 'type': 'text'}) + input1.construct() + # + - readonly (bool): Specifies that an input field is read-only. +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'readonly': True}) + input1.construct() + # + - required (bool): Specifies that an input field must be filled out before submitting the form. The required attribute works with the following input types: text, search, url, tel, email, password, date pickers, number, checkbox, radio, and file. +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'required': True, 'type': 'search'}) + input1.construct() + # + - size (int): Specifies the width, in characters, of an element. The size attribute works with the following input types: text, search, tel, url, email, and password. +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'size': '10', 'type': 'password'}) + input1.construct() + # + - src (str): Specifies the URL of the image to use as a submit button. The src attribute is required for , and can only be used with . +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'src': 'demo.asp', 'type': 'image'}) + input1.construct() + # + - step (int): Specifies the legal number intervals for an input field. The step attribute works with the following input types: number, range, date, datetime, datetime-local, month, time and week. +.. code-block:: python + + from korona.html.tags import Input + + input1 = Input(**{'step': 1, 'type': 'range'}) + input1.construct() + # + - type (str): Specifies the type element to display. -- value (str): Specifies the value of an element. The value attribute - cannot be used with . +.. code-block:: python -- width (int/float): Specifies the width of an element. The width - attribute is used only with . + from korona.html.tags import Input + input1 = Input(**{'type': 'submit'}) + input1.construct() + # -Korona can help you build ```` tag. +- value (str): Specifies the value of an element. The value attribute + cannot be used with . .. code-block:: python from korona.html.tags import Input - attributes = {'height': '30', 'width': '30', 'type': 'image', 'src': 'img_submit.jpeg'} + input1 = Input(**{'value': 'value1'}) + input1.construct() + # - # You can pass in the attributes in the form of a dictionary. - input1 = Input(**attributes) - # You can also pass in the attributes as args. - input2 = Input(height='30', width='30', type='image', src='img_submit.jpeg') +- width (int/float): Specifies the width of an element. The width + attribute is used only with . + +.. code-block:: python - input_tag1 = input1.construct() - input_tag2 = input2.construct() + from korona.html.tags import Input - assert input_tag1 == '' - assert input_tag1 == input_tag2 + input1 = Input(**{'width': '100', 'type': 'image'}) + input1.construct() + #