Andrew Overton d99e872320
[TextControls] Write docs for MDCTextControls (#9327)
This PR adds some initial docs for text controls.
Closes #8687.
2019-12-30 16:17:14 -05:00

27 lines
688 B
Markdown

### Creating a text field
<!--<div class="material-code-render" markdown="1">-->
#### Swift
```swift
let estimatedFrame = ...
let textField = MDCFilledTextField(frame: estimatedFrame)
textField.label.text = "This is the floating label"
textField.leadingAssistiveLabel.text = "This is helper text"
textField.sizeToFit()
view.addSubview(textField)
```
#### Objective-C
```objc
CGRect estimatedFrame = ...
MDCOutlinedTextField *textField = [[MDCOutlinedTextField alloc] initWithFrame:estimatedFrame];
textField.label.text = "This is the floating label";
textField.leadingAssistiveLabel.text = "This is helper text";
[textField sizeToFit];
[view addSubview:textField];
```
<!--</div>-->