# text-ellipsis()

## 용도 <a href="#use" id="use"></a>

텍스트가 설정된 길이보다 넘칠 정도로 길 경우, 생략할 때 사용하는 믹스인입니다.

## 사용법 <a href="#usage" id="usage"></a>

`text-ellipsis()` 믹스인에 설정 가능한 값을 리스트로 전달합니다.

> text-ellipsis($width:**number**, $hover-visible:**bool**)

```ruby
.usage {
  @include text-ellipsis(em(520), true);
}
```

| 매개변수(parameter) | 유형(type) | 필수(required) | 기본 값(default) |
| :-------------: | :------: | :----------: | :-----------: |
|      $width     |  number  |              |   `em(480)`   |
|  $hover-visible |   bool   |              |    `false`    |

위 예시 코드는 아래의 CSS로 컴파일 되어 출력됩니다.

```css
.usage {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 32.5em;
}

.usage:hover {
  overflow: visible;
}
```

## 로직 <a href="#logic" id="logic"></a>

`text()` 믹스인은 다음의 로직에 의해 작성되었습니다.&#x20;

```javascript
@mixin text-ellipsis($width: em(480), $hover-visible: false) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: unitless-px($width);
  
  @if $hover-visible {
    &:hover {
      overflow: visible;
    }
  }
}
```

1. 전달 받은 인자가 존재할 경우, 각 인자의 값을 설정
2. `$hover-visible` 값이 `true`일 경우, 요소에 마우스가 올라갔을 때 생략된 텍스트 모두 표시 설정

## 참고 <a href="#reference" id="reference"></a>

믹스인에 사용된 Sass의 빌트인 모듈은 다음과 같습니다.

* [@mixin / @include](https://sass-lang.com/documentation/at-rules/mixin)
* [@if / @else](https://sass-lang.com/documentation/at-rules/control/if)&#x20;

믹스인에 사용된 자체 제작 모듈은 다음과 같습니다.

* [unitless-px()](/scss-mixins/utilities/units/unitless-px.md)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yamoo9.gitbook.io/scss-mixins/mixins/text/text-ellipsis.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
