Coverage for gws-app/gws/plugin/model_widget/textarea/__init__.py: 0%

14 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-10-05 13:35 +0200

1"""Textarea widget. 

2 

3Multi-line text input with an optional height and placeholder text. 

4 

5Example:: 

6 

7 fields+ { 

8 name "description" 

9 type "text" 

10 widget { type "textarea" height 120 } 

11 } 

12""" 

13 

14import gws 

15import gws.base.model.widget 

16 

17 

18@gws.ext.config.modelWidget('textarea') 

19class Config(gws.base.model.widget.Config): 

20 """Multi-line text input.""" 

21 

22 height: int = 0 

23 """Height of the input in pixels.""" 

24 placeholder: str = '' 

25 """Hint text shown in the empty input.""" 

26 

27 

28@gws.ext.props.modelWidget('textarea') 

29class Props(gws.base.model.widget.Props): 

30 height: int 

31 placeholder: str 

32 

33 

34@gws.ext.object.modelWidget('textarea') 

35class Object(gws.base.model.widget.Object): 

36 """Textarea widget object.""" 

37 

38 def props(self, user): 

39 return gws.u.merge( 

40 super().props(user), 

41 placeholder=self.cfg('placeholder'), 

42 height=self.cfg('height'), 

43 )