# TextButton

TextButton : `GuiButton`

## Overview

TextButton은 텍스트 표시 방식은 TextLabel과 같지만, 버튼으로서의 상호작용 기능이 더해진 형태입니다. 즉, 텍스트를 표시하면서도 클릭·터치 같은 GuiButton의 이벤트를 사용할 수 있는 UI 요소입니다.

TextButton은 **클라이언트 환경**에서만 제어할 수 있습니다.

## Properties

### Bold

`bool`

TextButton에 표시되는 텍스트를 굵게(Bold) 렌더링할지 여부를 지정합니다.

#### Code Samples

```lua
local ScreenGui = script.Parent
local TextButton = ScreenGui:WaitForChild("TextButton")

TextButton.Bold = true
```

### Text

`string`

TextButton에 표시할 텍스트 값을 지정합니다.

텍스트는 색상, 투명도, 크기, 폰트, 정렬 등의 다양한 속성에 의해 시각적으로 표현됩니다.

또한 TextLabel과는 달리, 편집기(Properties 창)에서는 Shift + Enter로 줄바꿈을 입력할 수 없습니다. 줄바꿈이 필요할 경우 스크립트에서 \n 문자를 사용해야 개행이 적용됩니다.

#### Code Samples

```lua
local ScreenGui = script.Parent
local TextButton = ScreenGui:WaitForChild("TextButton")

TextButton.Text = "Hello"
```

### TextColor3

`Color3`

텍스트에 적용되는 색상을 지정합니다.

#### Code Samples

```lua
local ScreenGui = script.Parent
local TextButton = ScreenGui:WaitForChild("TextButton")

TextButton.TextColor3 = Color3.new(255, 0, 0)
```

### TextScaled

`bool`

텍스트가 TextButton의 전체 영역을 채우도록 자동으로 크기를 조정할지 여부를 결정합니다.

이 기능을 사용하면 TextSize 값은 무시되며, TextWrapped는 자동으로 활성화됩니다.

#### Code Samples

```lua
local ScreenGui = script.Parent
local TextButton = ScreenGui:WaitForChild("TextButton")

TextButton.TextScaled = true
```

### TextSize

`number`

텍스트의 크기를 Pixel 단위로 제어하며, 값이 클수록 텍스트가 더 크게 표시됩니다.

#### Code Samples

```lua
local ScreenGui = script.Parent
local TextButton = ScreenGui:WaitForChild("TextButton")

TextButton.TextSize = 50
```

### TextTransparency

`number`

텍스트의 투명도를 지정합니다.

0은 완전한 불투명 상태를 의미하고, 1은 전혀 보이지 않는 상태를 의미합니다.

배경을 숨기고 텍스트만 표시하고 싶다면 BackgroundTransparency를 1로 설정하면 됩니다.

#### Code Samples

```lua
local ScreenGui = script.Parent
local TextButton = ScreenGui:WaitForChild("TextButton")

TextButton.TextTransparency = 0.5
```

### TextWrapped

`bool`

TextButton의 텍스트가 요소의 영역을 넘어가지 않도록 자동으로 줄바꿈할지 여부를 지정합니다.

이 속성이 true로 설정되면 긴 문장은 TextButton의 폭에 맞추어 여러 줄로 나누어 표시되며, 줄 분리는 공백 문자를 기준으로 처리됩니다.

#### Code Samples

```lua
local ScreenGui = script.Parent
local TextButton = ScreenGui:WaitForChild("TextButton")

TextButton.TextWrapped = true
```

### TextXAlignment

`Enum.TextXAlignment`

텍스트가 TextButton 영역에서 왼쪽, 가운데, 오른쪽 중 어디에 배치될지를 지정합니다.

#### Code Samples

```lua
local ScreenGui = script.Parent
local TextButton = ScreenGui:WaitForChild("TextButton")

TextButton.TextXAlignment = Enum.TextXAlignment.Left
```

### TextYAlignment

`Enum.TextYAlignment`

텍스트가 TextButton 영역에서 위쪽, 가운데, 아래쪽 중 어디에 배치될지를 지정합니다.

#### Code Samples

```lua
local ScreenGui = script.Parent
local TextButton = ScreenGui:WaitForChild("TextButton")

TextButton.TextYAlignment = Enum.TextYAlignment.Top
```

## Methods

## Events

## See also

{% content-ref url="coregui" %}
[coregui](https://docs.overdare.com/korean/development/api-reference/classes/coregui)
{% endcontent-ref %}
