---
schema_version: "1"
id: 46f789107ea4a9f87616b4856605b3add4954a05143b2091a9443f94d72a184b
title: Adding and Customizing Input Field Labels
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/salesforce-pages-developers-guide/guides/pages/quick-start/pages-input-field-labels.md
canonical_url: https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-input-field-labels.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: a00cd3e41597078045b0bb6457fd23c3b7a1d3e8a79a67a1b781b3f70601a86e
products:
  - Visualforce Developer Guide
  - Platform Developer Content
---

# Adding and Customizing Input Field Labels

When used inside of a `<apex:pageBlockSection>` component, Visualforce input components and some output components automatically display a form label for the field. For components that map to standard or custom object fields, the displayed label is the object field label by default. To override the default value, and for components that aren’t mapped directly to object fields, you can set the label using the `label` attribute of the component. For example:

<!-- otherprops: set_clipboard -->
```apex_page
<apex:page standardController="Contact">
    <apex:form>
        <apex:pageBlock title="Quick Edit: {!Contact.Name}">
            <apex:pageBlockSection title="Contact Details" columns="1">
                <apex:inputField value="{!Contact.Phone}"/>
                <apex:outputField value="{!Contact.MobilePhone}" 
                    label="Mobile #"/>
                <apex:inputText value="{!Contact.Email}" 
                    label="{!Contact.FirstName + '’s Email'}"/>
            </apex:pageBlockSection>
            <apex:pageBlockButtons >
                <apex:commandButton action="{!save}" value="Save"/>
            </apex:pageBlockButtons>
        </apex:pageBlock>
    </apex:form>
</apex:page>

```

![Using the label attribute to customize form field labels.](https://developer.salesforce.com/media/salesforce-pages-developers-guide/pages_input_field_labels.png)

**note:** For this page to display contact data, the ID of a valid contact record must be specified as a query parameter in the URL for the page. For example,

```nolang
https://MyDomain_login_URL/apex/myPage?id=003D000000Q513R
```

[Displaying Field Values with Visualforce](https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-quick-start-display-field-values.md) has more information about retrieving the ID of a record.

The `label` attribute may be a string, or an expression that evaluates to a string. If you set `label` to an empty string, the form label for that field will be suppressed.

The `label` attribute can be set on the following Visualforce components:

-   `<apex:inputCheckbox>`
-   `<apex:inputField>`
-   `<apex:inputSecret>`
-   `<apex:inputText>`
-   `<apex:inputTextarea>`
-   `<apex:outputField>`
-   `<apex:outputText>`
-   `<apex:selectCheckboxes>`
-   `<apex:selectList>`
-   `<apex:selectRadio>`

## Custom Labels and Error Messages

When set, the `label` attribute will be used for component-level error messages, for example, when a field is required or must be unique. Custom labels won't be used in custom error messages, and the default object field label will be used instead. If you set a `label` attribute to an empty string, the default object field label will be used in all error messages.

