Dropdown Phone Entry
A phone-number entry form that pairs a country-code dropdown picker with pill input fields.
Overview
This example recreates a phone verification entry layout flow. Combining the DropDownControl for dial-code selection and PillInputField for phone-number input inside a single shared shell.
Controls Featured
- DropDownControl — wheel-style modal picker used for the dial code
- PillInputField — phone-number text entry field
- PillButton — send-code action button
Scene Setup
This package now ships a ready-made sample scene in Examples~/DropDownPhoneEntry/DropDownPhoneEntryDemo.unity.
If you want to recreate it manually instead:
- Create a new Unity scene.
- Add a GameObject with a
UIDocument. - Assign the sample panel settings from
Examples~/Shared/UIToolkitExtensionsExamplePanelSettings.asset. - Add the
DropDownPhoneEntryDemoMonoBehaviour fromExamples~/DropDownPhoneEntry/to the same GameObject. - Press Play.
What to Expect
The screen presents a single verification card with:
- A dial-code trigger on the left that opens the
DropDownControlpicker. - A
PillInputFieldon the right for entering a phone number. - A send button that stays disabled until the input contains at least 10 digits.
- A status label that reflects picker state, validation state, and the final sample send action.
Key Code Pattern
dialCodePicker = new DropDownControl
{
Items = new[] { "+1", "+33", "+44", "+49" },
};
phoneNumberInput.OnValueChanged += value =>
{
bool isValid = ExtractDigits(value).Length >= 10;
sendCodeButton.SetEnabled(isValid);
};