# TextField class

Namespace: [Grasshopper2.UI.Toolbar](https://developer.rhino3d.com/api/gh2/namespace/grasshopper2.ui.toolbar.md) · Assembly: [Grasshopper2](https://developer.rhino3d.com/api/gh2/assembly/grasshopper2.md)

```cs
public sealed class TextField : BarItem
```

A text box on a toolbar.

## Constructors

- [TextField](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/ctor.md): Create a new toolbar text field.

## Properties

- [Active](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/active.md): Gets or sets whether this text field is active.
- [AdjacentOnLeftSide](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/adjacentonleftside.md)
- [AdjacentOnRightSide](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/adjacentonrightside.md)
- [EnterPressed](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/enterpressed.md)
- [EscapePressed](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/escapepressed.md)
- [Optional](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/optional.md): Gets or sets whether this textfield is optional. I.e. whether the user can toggle the [TextField.Active](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/active.md) state.
- [Placeholder](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/placeholder.md): Gets or sets the placeholder text.
- [Prefix](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/prefix.md): Gets or sets a label drawn against the left edge of the field, faded, outside the editable text. Unlike the [TextField.Suffix](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/suffix.md) - which belongs to the value and travels with it - a prefix holds still, which is what makes it usable as a caption ("min", "max") in place of a separate label on the panel.
- [Suffix](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/suffix.md): Optional annotation drawn immediately after the text in a faded version of the text colour, typically a unit, i.e. " seconds". Include the leading space for breathing room. This is decoration, not content: it is never typed into, selected, measured for the caret, or handed to [TextField.Validator](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/validator.md). It says what the value means, and it is not drawn at all while the [TextField.Placeholder](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/placeholder.md) is showing.
- [Text](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/text.md)
- [Validator](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/validator.md): Optional validity test for the current text. When set and the (non-empty) text fails it, the field is drawn in a warning colour. Purely visual — it does not block typing; callers decide separately whether to act on the value.

## Methods

- [ClearSquiggle](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/clearsquiggle.md): Remove the squiggle previously set by [TextField.SetSquiggle(MessageLevel, string, string)](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/setsquiggle.md).
- [DrawDisabled](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/drawdisabled.md)
- [DrawFocus](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/drawfocus.md)
- [DrawHover](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/drawhover.md)
- [DrawNormal](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/drawnormal.md)
- [KeyDown](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/keydown.md)
- [Layout](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/layout.md)
- [MakeOptional](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/makeoptional.md)
- [MouseDoubleClick](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/mousedoubleclick.md)
- [MouseDown](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/mousedown.md)
- [MouseLeave](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/mouseleave.md)
- [MouseMove](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/mousemove.md)
- [MouseUp](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/mouseup.md)
- [SetSquiggle](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/setsquiggle.md): Underline the text with a coloured squiggle and replace the tooltip with an explanation. This flags a problem with the *content* of the field rather than with the field itself, in the manner of a spellchecker.
- [SetText](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/settext.md): Set new text content.
- [ShowTooltipAt](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/showtooltipat.md)
- [TextInput](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/textinput.md)

## Events

- [ActiveChanged](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/activechanged.md)
- [TextChanged](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.textfield/textchanged.md): Raised whenever the text changes.

## Inherited Members

- From [BarItem](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem.md): [Bar](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/bar.md), [Bounds](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/bounds.md), [Enabled](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/enabled.md), [Icon](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/icon.md), [KeyCode](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/keycode.md), [MaximumWidth](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/maximumwidth.md), [MinimumWidth](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/minimumwidth.md), [Nomen](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/nomen.md), [OffColour](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/offcolour.md), [OnColour](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/oncolour.md), [CreateOutline](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/createoutline.md), [Draw](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/draw.md), [DrawIcon](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/drawicon.md), [DrawIconAndText](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/drawiconandtext.md), [DrawText](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/drawtext.md), [FindGroupByChapter<T>](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/findgroupbychapter.md), [FindGroupBySection<T>](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/findgroupbysection.md), [HasNeighbourToTheLeft](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/hasneighbourtotheleft.md), [HasNeighbourToTheRight](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/hasneighbourtotheright.md), [IsEnabled](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/isenabled.md), [KeyUp](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/keyup.md), [NeighbourToTheLeft](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/neighbourtotheleft.md), [NeighbourToTheRight](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/neighbourtotheright.md), [OverrideInfo](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/overrideinfo.md), [OverrideText](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/overridetext.md), [SetSizeLimits](https://developer.rhino3d.com/api/gh2/type/grasshopper2.ui.toolbar.baritem/setsizelimits.md)
