Coverage for src / lexigram / ui / atoms / divider.py: 100%

15 statements  

« prev     ^ index     » next       coverage.py v7.13.5, created at 2026-08-10 04:11 +0800

1from __future__ import annotations 

2 

3from typing import Any 

4 

5from lexigram.ui.core.base import Component, el 

6 

7 

8class Divider(Component): 

9 """Render a divider line. 

10 

11 Args: 

12 orientation: 'horizontal' or 'vertical' 

13 class_name: Additional CSS classes 

14 """ 

15 

16 def __init__( 

17 self, 

18 orientation: str = "horizontal", 

19 class_name: str = "", 

20 **props, 

21 ) -> None: 

22 super().__init__(**props) 

23 self.orientation = orientation 

24 self.class_name = class_name 

25 

26 def render(self) -> Any: 

27 extra_attrs = { 

28 k: v 

29 for k, v in self.props.items() 

30 if k not in ("class_", "class", "children") 

31 } 

32 if self.orientation == "vertical": 

33 cls = f"border-l border-border {self.class_name}".strip() 

34 return el("div", "", class_=cls, **extra_attrs) 

35 

36 cls = f"border-t border-border {self.class_name}".strip() 

37 return el("hr", class_=cls, **extra_attrs)